Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 11

COURSE TITLE: Intermediate Programming (Java)

MODULE: 1

OVERVIEW
Getting started with Java Language
 History  Tools You Will Need
 Java is…  Local Environment Setup
 Popular Java Editors

MODULE OUTCOMES
At the end of this module, the students must have:
 discussed the origin and recent releases of Java Programming Language;
 distinguised the advantages of Java compare to other programming languages;
 installed Java Application;
 differentiated the different popular Java editors.

INTRODUCTION
Java programming language was originally developed by Sun Microsystems which was initiated by
James Gosling and released in 1995 as core component of Sun Microsystems' Java platform (Java 1.0
[J2SE]).
The latest release of the Java Standard Edition is Java SE 8. With the advancement of Java and its
widespread popularity, multiple configurations were built to suit various types of platforms. For
example: J2EE for Enterprise Applications, J2ME for Mobile Applications.
The new J2 versions were renamed as Java SE, Java EE, and Java ME respectively. Java is guaranteed
to be Write Once, Run Anywhere.

DISCUSSION
History of Java
James Gosling initiated Java language project in June 1991 for use in one of his many set-top box
projects. The language, initially called ‘Oak’ after an oak tree that stood outside Gosling's office, also
went by the name ‘Green’ and ended up later being renamed as Java, from a list of random words.
Sun released the first public implementation as Java 1.0 in 1995. It promised Write Once, Run
Anywhere (WORA), providing no-cost run-times on popular platforms.
On 13 November, 2006, Sun released much of Java as free and open source software under the terms
of the GNU General Public License (GPL).
On 8 May, 2007, Sun finished the process, making all of Java's core code free and open-source, aside
from a small portion of code to which Sun did not hold the copyright.

Java Editions and Versions


Java technology is both a programming language and a platform. The Java programming language is a
high-level object-oriented language that has a particular syntax and style. A Java platform is a
particular environment in which Java programming language applications run.

There are several Java platforms. Many developers, even long-time Java programming language
developers, do not understand how the different platforms relate to each other.

There are four platforms of the Java programming language:


 Java Platform, Standard Edition (Java SE)
 Java Platform, Enterprise Edition (Java EE)
 Java Platform, Micro Edition (Java ME)
 Java FX

All Java platforms consist of a Java Virtual Machine (VM) and an application programming interface
(API). The Java Virtual Machine is a program, for a particular hardware and software platform, that
runs Java technology applications. An API is a collection of software components that you can use to
create other software components or applications. Each Java platform provides a virtual machine and
an API, and this allows applications written for that platform to run on any compatible system with all
the advantages of the Java programming language: platform-independence, power, stability, ease-of-
development, and security.
Java SE
When most people think of the Java programming language, they think of the Java SE API. Java SE's
API provides the core functionality of the Java programming language. It defines everything from the
basic types and objects of the Java programming language to high-level classes that are used for
networking, security, database access, graphical user interface (GUI) development, and XML parsing.

In addition to the core API, the Java SE platform consists of a virtual machine, development tools,
deployment technologies, and other class libraries and toolkits commonly used in Java technology
applications.

Java EE
The Java EE platform is built on top of the Java SE platform. The Java EE platform provides an API and
runtime environment for developing and running large-scale, multi-tiered, scalable, reliable, and secure
network applications.

Java ME
The Java ME platform provides an API and a small-footprint virtual machine for running Java
programming language applications on small devices, like mobile phones. The API is a subset of the
Java SE API, along with special class libraries useful for small device application development. Java ME
applications are often clients of Java EE platform services.

Java FX
Java FX technology is a platform for creating rich internet applications written in Java FX ScriptTM.
Java FX Script is a statically-typed declarative language that is compiled to Java technology bytecode,
which can then be run on a Java VM. Applications written for the Java FX platform can include and link
to Java programming language classes, and may be clients of Java EE platform services.

Java is −
 Object Oriented − In Java, everything is an Object. Java can be easily extended since it is
based on the Object model.
 Platform Independent − Unlike many other programming languages including C and C++,
when Java is compiled, it is not compiled into platform specific machine, rather into platform
independent byte code. This byte code is distributed over the web and interpreted by the
Virtual Machine (JVM) on whichever platform it is being run on.
 Simple − Java is designed to be easy to learn. If you understand the basic concept of OOP
Java, it would be easy to master.
 Secure − With Java's secure feature it enables to develop virus-free, tamper-free systems.
Authentication techniques are based on public-key encryption.
 Architecture-neutral − Java compiler generates an architecture-neutral object file format,
which makes the compiled code executable on many processors, with the presence of Java
runtime system.
 Portable − Being architecture-neutral and having no implementation dependent aspects of the
specification makes Java portable. Compiler in Java is written in ANSI C with a clean portability
boundary, which is a POSIX subset.
 Robust − Java makes an effort to eliminate error prone situations by emphasizing mainly on
compile time error checking and runtime checking.
 Multithreaded − With Java's multithreaded feature it is possible to write programs that can
perform many tasks simultaneously. This design feature allows the developers to construct
interactive applications that can run smoothly.
 Interpreted − Java byte code is translated on the fly to native machine instructions and is not
stored anywhere. The development process is more rapid and analytical since the linking is an
incremental and light-weight process.
 High Performance − With the use of Just-In-Time compilers, Java enables high performance.
 Distributed − Java is designed for the distributed environment of the internet.
 Dynamic − Java is considered to be more dynamic than C or C++ since it is designed to adapt
to an evolving environment. Java programs can carry extensive amount of run-time
information that can be used to verify and resolve accesses to objects on run-time.

Tools You Will Need


You will also need the following softwares −

 Linux 7.1 or Windows xp/7/8 operating system


 Java JDK 8
 Microsoft Notepad or any other text editor

Environment Setup

Local Environment Setup


Java SE is freely available from the link Download Java. You can download a version based on your
operating system.
Follow the instructions to download Java and run the .exe to install Java on your machine. Once you
installed Java on your machine, you will need to set environment variables to point to correct
installation directories −

Setting Up the Path for Windows


Assuming you have installed Java in c:\Program Files\java\jdk directory −
 Right-click on 'My Computer' and select 'Properties'.
 Click the 'Environment variables' button under the 'Advanced' tab.
 Now, alter the 'Path' variable so that it also contains the path to the Java executable. Example,
if the path is currently set to 'C:\WINDOWS\SYSTEM32', then change your path to read
'C:\WINDOWS\SYSTEM32;c:\Program Files\java\jdk\bin'.

Setting Up the Path for Linux, UNIX, Solaris, FreeBSD


Environment variable PATH should be set to point to where the Java binaries have been installed.
Refer to your shell documentation, if you have trouble doing this.
Example, if you use bash as your shell, then you would add the following line to the end of your
'.bashrc: export PATH = /path/to/java:$PATH'

Popular Java Editors


To write your Java programs, you will need a text editor. There are even more sophisticated IDEs
available in the market. But for now, you can consider one of the following −
 Notepad − On Windows machine, you can use any simple text editor like Notepad
(Recommended for this tutorial), TextPad.
 Netbeans − A Java IDE that is open-source and free which can be downloaded
from https://www.netbeans.org/index.html.
 Eclipse − A Java IDE developed by the eclipse open-source community and can be
downloaded from https://www.eclipse.org/.

Activity No. 1
Name: Date:
Year and Section: Signature:

(20 points) Research on the latest Java Platform SE release. What are the New Features and
Enhancements?
Activity No. 2
Name: Date:
Year and Section: Signature:

(20 points) Choose one Java Editor and research on its history.

SUMMARY

 Java is a high level, object-oriented, platform independent language.


 Java, unlike some languages before it allows for the use of words and commands instead of just
symbols and numbers. Java also allows for the creation of advanced data types called objects
which represent real world things like a chair or a computer where you can set the attributes of
these objects and things they do.
 Java is very flexible - it can be used to develop software as well as applets (small programs that
run on webpages). But the flexibility doesn't end there because you can run the same Java
programs on various operating systems without having to rewrite the code (unlike some other
languages such as C and C++) thanks to the Java run-time environment which interprets Java
code and tells the operating system what to do.
 Learning Java serves as a good introduction to software development.
RUBRICS for Activity No. 1 and 2
Category 4 3 2 1
Neatness and The work is The work is The work is The work appears
organization presented in a presented in a presented in an sloppy and
neat, clear, neat and organized fashion unorganized. It is
organized fashion organized fashion but may be hard hard to know what
that is easy to that is usually to read at times. information goes
read. easy to read. together.
Understanding I got it!! I did it in I got it. I I understood parts I did not
new ways and understood the of the problem. I understand the
showed you how it problem and have got started, but I problem.
worked. I can tell an appropriate couldn’t finish.
you what concepts solution. All parts
are used. of the problem are
addressed.
Explanation Complete Good solid Explanation is Misses key points
response with a response with unclear
detailed clear explanation
explanation
Demonstration of Shows complete Response shows Response shows Response shows a
Knowledge understanding of substantial SOME complete lack of
questions, ideas, understanding understanding understanding
and processes
Requirements Goes beyond the Meets the Hardly meets the Does not meet the
requirements requirements requirements requirements

Put a check on the topic whether you can understand it on your own, need more reference material, or
if you can’t understand.
SELF ASSESSMENT
I CAN DO IT WITH
I CAN DO IT ON MY THE HELP OF A I CANNOT
OWN. REFERENCE UNDERSTAND.
MATERIAL.
Getting started with
Java Language
Please write your written feedback below:

Name: Date:
Year and Section: Signature:

REFERENCES
1. CADENHEAD, R. (2018). SAMS TEACH YOURSELF JAVA IN 21 DAYS. 800 EAST 96TH
STREET, INDIANAPOLIS, INDIANA 46240. PEARSON EDUCATION.
2. ECK,D.(2017). INTRODUCTION TO PROGRAMMING USING JAVA. HOBART AND WILLIAM
SMITH COLLEGES, GENEVA, NY 14456
3. MEDLEY, R. (2018, JUNE 7). NETBEANS. RETRIEVED FROM NETBEANS.ORG:
HTTPS://EDU.NETBEANS.ORG/CONTRIB/JEDI/INTRO-TO-PROGRAMMING- 1/COURSE-
OUTLINE.PDF
4. SHICHT, H. (2018, JUNE 7). COMPUTER_FUNDAMENTALS. RETRIEVED FROM
TUTORIALSPOINT.COM:
HTTPS://WWW.TUTORIALSPOINT.COM/COMPUTER_FUNDAMENTALS/COMPUTER_NUMBER
_SYSTEM.HTM

SUGGESTED READINGS
1. HTTPS://WWW.W3SCHOOLS.COM/JAVA/
2. HTTPS://WWW.TUTORIALSPOINT.COM/JAVA/INDEX.HTM
 PRIMITIVE DATA TYPES IN JAVA
O INTRODUCTION
O SYNTAX
O CONVERTING PRIMITIVES
O MEMORY CONSUMPTION OF PRIMITIVES VS. BOXED PRIMITIVES
O NEGATIVE VALUE REPRESENTATION
O PRIMITIVE TYPES CHEATSHEET
O THE BOOLEAN PRIMITIVE
O THE BYTE PRIMITIVE
O THE CHAR PRIMITIVE
O THE DOUBLE PRIMITIVE
O THE FLOAT PRIMITIVE
O THE INT PRIMITIVE
O THE LONG PRIMITIVE
O THE SHORT PRIMITIVE
 OPERATORS IN JAVA
O INTRODUCTION
O REMARKS
O THE ARITHMETIC OPERATORS (+, -, *, /, %)
O THE ASSIGNMENT OPERATORS (=, +=, -=, *=, /=, %=, <<=, >>= , >>>=, &=, |= AND ^=)
O THE BITWISE AND LOGICAL OPERATORS (~, &, |, ^)
O THE THE CONDITIONAL-AND AND CONDITIONAL-OR OPERATORS ( && AND || ) CONDITIONAL
OPERATOR (? :)
O THE EQUALITY OPERATORS (==, !=)
O THE INCREMENT/DECREMENT OPERATORS (++/--)
O THE INSTANCEOF OPERATOR
O THE LAMBDA OPERATOR ( -> )
O THE RELATIONAL OPERATORS (<, <=, >, >=)
O THE SHIFT OPERATORS (<<, >> AND >>>)
O THE STRING CONCATENATION OPERATOR (+)
 STRINGS IN JAVA
O INTRODUCTION
O REMARKS
O ADDING TOSTRING() METHOD FOR CUSTOM OBJECTS
O CASE INSENSITIVE SWITCH
O CHANGING THE CASE OF CHARACTERS WITHIN A STRING
O COMPARING STRINGS
O COUNTING OCCURRENCES OF A SUBSTRING OR CHARACTER IN A STRING
O FINDING A STRING WITHIN ANOTHER STRING
O GETTING THE LENGTH OF A STRING
O GETTING THE NTH CHARACTER IN A STRING
O JOINING STRINGS WITH A DELIMITER
O PLATFORM INDEPENDENT NEW LINE SEPARATOR
O REMOVE WHITESPACE FROM THE BEGINNING AND END OF A STRING
O REPLACING PARTS OF STRINGS
O REVERSING STRINGS
O SPLITTING STRINGS
O STRING CONCATENATION AND STRINGBUILDERS
O STRING POOL AND HEAP STORAGE
O SUBSTRINGS
 BASIC CONTROL STRUCTURES
O INTRODUCTION
O REMARKS
O BREAK
O CONTINUE STATEMENT IN JAVA
O DO...WHILE LOOP
O FOR EACH
O FOR LOOPS
O IF / ELSE
O IF / ELSE IF / ELSE CONTROL
O NESTED BREAK / CONTINUE
O SWITCH STATEMENT
O TERNARY OPERATOR
O TRY ... CATCH ... FINALLY
O WHILE LOOPS
 CLASSES AND OBJECTS
O INTRODUCTION
O SYNTAX
O BASIC OBJECT CONSTRUCTION AND USE
O CONSTRUCTORS
O EXPLAINING WHAT IS METHOD OVERLOADING AND OVERRIDING
O INITIALIZING STATIC FINAL FIELDS USING A STATIC INITIALIZER
O OBJECT MEMBER VS STATIC MEMBER
O OVERLOADING METHODS
O SIMPLEST POSSIBLE CLASS
 ARRAYS
O INTRODUCTION
O SYNTAX
O PARAMETERS
O ARRAY COVARIANCE
O ARRAYINDEXOUTOFBOUNDSEXCEPTION
O ARRAYS TO A STRING
O ARRAYS TO STREAM
O CASTING ARRAYS
O COMPARING ARRAYS FOR EQUALITY
O CONVERTING ARRAYS BETWEEN PRIMITIVES AND BOXED TYPES
O COPYING ARRAYS
O CREATING A LIST FROM AN ARRAY
O CREATING AN ARRAY FROM A COLLECTION
O CREATING AND INITIALIZING ARRAYS
O FINDING AN ELEMENT IN AN ARRAY
O GETTING THE LENGTH OF AN ARRAY
O HOW DO YOU CHANGE THE SIZE OF AN ARRAY?
O ITERATING OVER ARRAYS
O MULTIDIMENSIONAL AND JAGGED ARRAYS
O REMOVE AN ELEMENT FROM AN ARRAY
O SORTING ARRAYS
 ORACLE OFFICIAL CODE STANDARD
O INTRODUCTION
O REMARKS
O ANNOTATIONS
O BRACES
O CLASS STRUCTURE
O IMPORT STATEMENTS
O INDENTATION
O JAVA SOURCE FILES
O LAMBDA EXPRESSIONS
O LITERALS
O MODIFIERS
O NAMING CONVENTIONS
O PACKAGE DECLARATION
O REDUNDANT PARENTHESES
O SPECIAL CHARACTERS
O VARIABLE DECLARATIONS
O WHITESPACE
O WRAPPING EXPRESSIONS
O WRAPPING METHOD DECLARATIONS
o WRAPPING STATEMENTS

You might also like