Unit-I
Java Evolution : History – Features –
Differences between C++ and Java – Java
Environment – Java Development Kit –
Application Programming Interface –
Overview of Java Language – Introduction –
Java Program Structure – Java tokens- Java
Statements – Implementing a Java Program –
Java Virtual Machine – Command line
arguments – Constants, Variables and Data
types – Basic Input/ Output – Simple Java
Program – Operators and Expressions –
*Branching and Looping Statements*
,Java History
Java is a general-purpose, object-oriented programming language developed by Sun Microsystems in
1991.
It was initially designed for consumer electronics but later focused on the internet.
Today, Java is one of the most widely used programming languages on the internet.
Java is platform-independent, meaning programs written in Java can run on any hardware or
operating system without modification.
It was created by James Gosling, Patrick Naughton, Chris Warth, Ed Frank, and Mike Sheridan.
Originally called "Oak," the language was renamed "Java" in 1995.
Java Milestones
1990: Sun Microsystems formed a team, led by James Gosling, to develop software for consumer
electronics.
1991: The team introduced "Oak," a new object-oriented language.
1992: The team demonstrated Oak's ability to control home appliances.
1993: The focus shifted to developing web applets with the rise of the World Wide Web.
1994: The HotJava browser was developed to run applets on the internet.
1995: Oak was renamed "Java"; Netscape and Microsoft announced support.
1996: Java became a leading language for internet programming with the release of Java
Development Kit (JDK) 1.0.
1997: JDK 1.1 was released.
1998: Java 2 (SDK 1.2) was released.
1999: Java 2 Platform (J2SE and J2EE) was released.
2000: J2SE (SDK 1.3) was released.
2002: J2SE (SDK 1.4) was released.
2006: Java SE 6 was released, renaming "J2SE" to "Java SE."
2010: Oracle acquired Sun Microsystems, taking over Java’s maintenance and distribution.
2011: Java SE 7 was released.
2014: Java SE 8 was released.
2017: Java SE 9 was released.
2018: Java SE 11 was released.
Ongoing: Oracle continues to maintain, update, and distribute Java.
,Java Features/Java Buzzwords
1.Simple
Java is easy to learn, especially for those familiar with C and C++.
Eliminates complexities like operator overloading, direct pointer manipulation, and pointer
arithmetic.
Includes automatic garbage collection.
2. Object Oriented
Java is a true object-oriented language, with almost everything being an object.
Code and data are organized in objects and classes, with an extensive set of pre-built classes
and packages.
3. Compiled and Interpreted
Java works in two stages:
The Java compiler translates source code into bytecode.
The Java interpreter converts the bytecode into machine-level instructions.
Bytecode is platform-independent and executed by the Java Virtual Machine (JVM).
4. Platform Independent and Portable
Java programs are "Write-Once, Run-Anywhere," meaning they can run on any platform without
modification.
Java bytecode is portable across different systems, regardless of the operating system or
hardware.
5. Robust and Secure
Java ensures reliability with strict compile-time and runtime checks, strong memory
management, and automatic garbage collection.
Exception handling prevents system crashes.
Java's security features, like the JVM’s checks, protect against viruses and malicious programs.
6.Distributed/Network-Oriented
Java is designed for creating distributed applications.
It supports sharing data and programs across networks, allowing easy access to remote objects
on the internet.
, 7. Multithreaded and Interactive
Java supports multithreading, enabling multiple tasks to run simultaneously without waiting for
each other to finish.
This improves the performance of interactive applications, such as listening to music while
downloading files.
8. High Performance
Java offers high performance with efficient bytecode and built-in multithreading.
Just-In-Time (JIT) compilers enable near-native runtime performance.
9. Dynamic and Extensible
Java is dynamic, allowing new class libraries, methods, and objects to be linked at runtime.
Java also supports native methods (written in other languages like C or C++) that are
dynamically linked during execution.
Java vs. C++
• True Object-Oriented: Java is a true object-oriented language, while C++ is based
on C with object-oriented extensions.
• No Operator Overloading: Java does not support operator overloading, unlike C++.
• No Templates: Java does not have template classes, a feature available in C++.
• No Multiple Inheritance: Java does not support multiple inheritance directly, but
uses "Interfaces" to achieve similar functionality.
• No Pointers: Java does not use pointers, unlike C++.
• No Global Variables: Java does not support global variables.
• Finalize Method: Java replaces C++ destructors with the finalize() method.
• No Header Files: Java does not require header files, unlike C++.
Java Environment
The Java environment consists of:
1. Development Tools – Part of the Java Development Kit (JDK).
2. Classes and Methods – Part of the Java Standard Library (JSL), also known as the
Application Programming Interface (API).
1. Java Development Kit (JDK)
The JDK includes tools and libraries necessary for creating, testing, documenting, and
running Java programs.
• Javac: The Java compiler.
• Java: The Java interpreter.
• Javap: Java disassembler.
• Javah: For generating C header files.
• Javadoc: For creating HTML documentation.
• Jdb: The Java debugger.
Java Evolution : History – Features –
Differences between C++ and Java – Java
Environment – Java Development Kit –
Application Programming Interface –
Overview of Java Language – Introduction –
Java Program Structure – Java tokens- Java
Statements – Implementing a Java Program –
Java Virtual Machine – Command line
arguments – Constants, Variables and Data
types – Basic Input/ Output – Simple Java
Program – Operators and Expressions –
*Branching and Looping Statements*
,Java History
Java is a general-purpose, object-oriented programming language developed by Sun Microsystems in
1991.
It was initially designed for consumer electronics but later focused on the internet.
Today, Java is one of the most widely used programming languages on the internet.
Java is platform-independent, meaning programs written in Java can run on any hardware or
operating system without modification.
It was created by James Gosling, Patrick Naughton, Chris Warth, Ed Frank, and Mike Sheridan.
Originally called "Oak," the language was renamed "Java" in 1995.
Java Milestones
1990: Sun Microsystems formed a team, led by James Gosling, to develop software for consumer
electronics.
1991: The team introduced "Oak," a new object-oriented language.
1992: The team demonstrated Oak's ability to control home appliances.
1993: The focus shifted to developing web applets with the rise of the World Wide Web.
1994: The HotJava browser was developed to run applets on the internet.
1995: Oak was renamed "Java"; Netscape and Microsoft announced support.
1996: Java became a leading language for internet programming with the release of Java
Development Kit (JDK) 1.0.
1997: JDK 1.1 was released.
1998: Java 2 (SDK 1.2) was released.
1999: Java 2 Platform (J2SE and J2EE) was released.
2000: J2SE (SDK 1.3) was released.
2002: J2SE (SDK 1.4) was released.
2006: Java SE 6 was released, renaming "J2SE" to "Java SE."
2010: Oracle acquired Sun Microsystems, taking over Java’s maintenance and distribution.
2011: Java SE 7 was released.
2014: Java SE 8 was released.
2017: Java SE 9 was released.
2018: Java SE 11 was released.
Ongoing: Oracle continues to maintain, update, and distribute Java.
,Java Features/Java Buzzwords
1.Simple
Java is easy to learn, especially for those familiar with C and C++.
Eliminates complexities like operator overloading, direct pointer manipulation, and pointer
arithmetic.
Includes automatic garbage collection.
2. Object Oriented
Java is a true object-oriented language, with almost everything being an object.
Code and data are organized in objects and classes, with an extensive set of pre-built classes
and packages.
3. Compiled and Interpreted
Java works in two stages:
The Java compiler translates source code into bytecode.
The Java interpreter converts the bytecode into machine-level instructions.
Bytecode is platform-independent and executed by the Java Virtual Machine (JVM).
4. Platform Independent and Portable
Java programs are "Write-Once, Run-Anywhere," meaning they can run on any platform without
modification.
Java bytecode is portable across different systems, regardless of the operating system or
hardware.
5. Robust and Secure
Java ensures reliability with strict compile-time and runtime checks, strong memory
management, and automatic garbage collection.
Exception handling prevents system crashes.
Java's security features, like the JVM’s checks, protect against viruses and malicious programs.
6.Distributed/Network-Oriented
Java is designed for creating distributed applications.
It supports sharing data and programs across networks, allowing easy access to remote objects
on the internet.
, 7. Multithreaded and Interactive
Java supports multithreading, enabling multiple tasks to run simultaneously without waiting for
each other to finish.
This improves the performance of interactive applications, such as listening to music while
downloading files.
8. High Performance
Java offers high performance with efficient bytecode and built-in multithreading.
Just-In-Time (JIT) compilers enable near-native runtime performance.
9. Dynamic and Extensible
Java is dynamic, allowing new class libraries, methods, and objects to be linked at runtime.
Java also supports native methods (written in other languages like C or C++) that are
dynamically linked during execution.
Java vs. C++
• True Object-Oriented: Java is a true object-oriented language, while C++ is based
on C with object-oriented extensions.
• No Operator Overloading: Java does not support operator overloading, unlike C++.
• No Templates: Java does not have template classes, a feature available in C++.
• No Multiple Inheritance: Java does not support multiple inheritance directly, but
uses "Interfaces" to achieve similar functionality.
• No Pointers: Java does not use pointers, unlike C++.
• No Global Variables: Java does not support global variables.
• Finalize Method: Java replaces C++ destructors with the finalize() method.
• No Header Files: Java does not require header files, unlike C++.
Java Environment
The Java environment consists of:
1. Development Tools – Part of the Java Development Kit (JDK).
2. Classes and Methods – Part of the Java Standard Library (JSL), also known as the
Application Programming Interface (API).
1. Java Development Kit (JDK)
The JDK includes tools and libraries necessary for creating, testing, documenting, and
running Java programs.
• Javac: The Java compiler.
• Java: The Java interpreter.
• Javap: Java disassembler.
• Javah: For generating C header files.
• Javadoc: For creating HTML documentation.
• Jdb: The Java debugger.