1. Java History
Key Facts
- Father of Java: James Gosling
- Java introduced at: Sun Microsystems
- Java was originally called: Oak
- First public implementation: Java 1.0 in 1995
- Core principle: Write Once, Run Anywhere (WORA)
The source notes describe Java as an object-oriented programming language with a runtime environment. It combines features associated with C and C++ with additional concepts and is suitable for standalone as well as web application development.
2. What is Java?
- Java is an object-oriented programming language developed by Sun Microsystems and released in 1995.
- James Gosling initially developed Java at Sun Microsystems, which was later merged with Oracle Corporation.
- Java is described in the source as having its format from C and OOP features from C++.
- Java programs are platform independent: the same compiled program can run on different operating systems when the appropriate Java runtime is available.
- The ability to write code once and run it on different platforms is commonly summarized as WORA — Write Once, Run Anywhere.
3. Object-Oriented Paradigm
The primary objective of the object-oriented technique is to eliminate some flaws encountered in the procedural approach.
OOP treats data as a critical element and uses objects and methods to organize and protect that data.
4. Major Objectives of Object-Oriented Programming
- The emphasis is on the data rather than the procedures.
- Methods that operate on data are tied together in a data structure.
- Programs are divided into small instances called objects.
- Data remains hidden and cannot be accessed directly by external functions.
- Objects may communicate with each other through methods.
- Programs follow the bottom-up approach.
- New data and methods can be added whenever necessary.
5. Basic Terms and Features of OOP
Classes & Objects
Represent the structure and instances of an object-oriented program.
Data Abstraction
Expose essential behavior while hiding implementation details.
Data Encapsulation
Wrap data and the methods that operate on it together.
Inheritance
Allows a class to acquire features from another class.
Polymorphism
Allows one interface or operation to have multiple forms.
Dynamic Binding
Connects an overridden method call with its implementation at runtime.
Composition
Builds complex objects by combining other objects.
6. Advantages of OOP
- Code recycle and reuse.
- Wrapping up of data into a single unit.
- Easy to partition project work based on objects.
- Message passing between objects makes interface descriptions with external systems more straightforward.
- Software complexity can be handled and managed more easily.
- Objects in a problem domain can be mapped into a program.
- Data hiding is possible.
- Inheritance can eliminate redundant code.
7. Java Features
| Feature | Description |
|---|---|
| Platform Independent | The same .class bytecode can work on different operating systems with a suitable Java runtime. |
| Simple | The source describes Java as small and familiar to C and C++ programmers. |
| Object Oriented | Focuses on data and the interface to it through objects. |
| Distributed | Supports applications that operate across networked systems. |
| Portable | Java programs are designed to move between platforms with minimal platform-specific changes. |
| Interpreted | Java bytecode is executed by the Java runtime. |
| High Performance | JIT (Just-In-Time) compilation improves runtime performance. |
| Multithreaded | Supports execution of multiple threads. |
| Dynamic | Java supports dynamic loading and runtime linking concepts. |
8. Types of Java Applications
1. Standalone Applications
A Java application designed without a client-server architecture is called a standalone application.
2. Distributed Applications
A Java application designed on the basis of a client-server architecture is called a distributed application.
The source notes associate distributed application development with the J2EE / Java EE platform.
9. Java Details
| Item | Details from the Source |
|---|---|
| Home / Vendor | Sun Microsystems (later Oracle Corporation) |
| Author | James Gosling |
| Objective | To prepare simple electronic consumer goods |
| Project | Green |
| First Version | JDK 1.0 (January 23, 1996) |
| Type | Open Source Software, as stated in the source notes |
10. Java Introduction Details
The source's Java introduction page identifies James Gosling as author, Sun Microsystems as vendor, Green Project as the project name, Oak as the initial name, Java as the present name, and WORA as the slogan/motto.
| Item | Source Information |
|---|---|
| Author | James Gosling |
| Vendor | Sun Micro System (later merged into Oracle Corporation) |
| Project Name | Green Project |
| Type | Open source & free software |
| Initial Name | OAK language |
| Present Name | Java |
| Extensions | .java, .class & .jar |
| Initial Version | JDK 1.0 |
| Present Version in Source | J2SE 8 / 2014 |
| Operating System | Multi Operating System |
| Implementation Language | C, C++ |
| Objective | To develop web applications |
| SUN | Stanford University Network |
| Slogan / Motto | WORA — Write Once, Run Anywhere |
11. Importance of Core Java
According to the source notes, Java is used in a wide range of applications and technologies.
- Desktop applications such as media players and antivirus applications.
- Web applications.
- Enterprise applications such as banking applications.
- Mobile applications.
- Embedded systems.
- SmartCards.
- Robotics.
- Games.
Core Java Ecosystem Mentioned in the Source
Webservices, Hadoop, Selenium, Android, Cloud Computing, ADF, EJBs, Spring, Hibernate and Struts are shown around Core Java in the source diagram.
12. Parts of Java
The source states that, according to Sun Microsystems, the Java language/platform is divided into three parts:
| Part | Full Form |
|---|---|
| J2SE / JSE | Java 2 Standard Edition |
| J2EE / JEE | Java 2 Enterprise Edition |
| J2ME / JME | Java 2 Micro Edition |
13. JDK Includes
| Tool | Purpose |
|---|---|
javac | Java Compiler |
java | Java Interpreter / launcher |
javap | Java Disassembler |
javah | Used for C-language header files in the source notes |
javadoc | Creates HTML documentation |
jdb | Java Debugger |
14. Java Program Start to END Flow
The source flow chart shows the basic path:
The diagram also shows javah leading to header files and the Java class file leading to the debugger path.
15. Tokens
The smallest logical unit in Java programming is called a lexeme. A collection of lexemes belonging to a particular group is called a token.
Example
int a = b + c * d;
Lexemes: int, a, =, b, +, c, *, d, ;
Types of Tokens
Identifiers
Names assigned to programming elements.
Literals
Constant values assigned or used in programs.
Keywords / Reserved Words
Predefined words recognized by Java.
Operators
Symbols that perform operations on operands.
16. Identifiers
An identifier is a name assigned to programming elements such as variables, methods, classes, abstract classes and interfaces.
int a = 10;
| Element | Meaning |
|---|---|
int | Data type |
a | Variable / identifier |
= | Operator |
10 | Constant / literal |
; | Terminator |
17. Literals
A literal is a constant value represented directly in a Java program.
| Literal Type | Examples |
|---|---|
| Integer / Integral | byte, short, int, long → 10, 20, 30... |
| Character | 'A', 'B'... |
| Floating Point | float → 10.22f; double → 11.123 |
| Boolean | true, false |
| String | "abc", "def"... |
18. Number Systems in Java
Programming languages use number systems to represent numbers. The source lists four common number systems.
Binary
Base 2
Octal
Base 8
Decimal
Base 10
Hexadecimal
Base 16
19. Keywords / Reserved Words
The source defines a keyword as a predefined word having recognition and internal functionality. It also distinguishes reserved words as predefined words reserved by the language.
goto, const.Keyword Categories
| Category | Examples |
|---|---|
| Data Types / Return Types | byte, short, int, long, float, double, char, boolean, void |
| Access / Other Modifiers | public, protected, private, static, final, abstract, native, volatile, transient, synchronized, strictfp |
| Flow Controllers | if, else, switch, case, default, for, while, do, break, continue, return |
| Class / Object Related | class, enum, extends, interface, implements, package, import, new, this, super |
| Exception Handling | throw, throws, try, catch, finally |
20. Operators
An operator is a symbol that performs a particular operation over the provided operands.
| Operator Type | Operators |
|---|---|
| Arithmetic | + - * / % ++ -- |
| Assignment | = += -= *= /= %= |
| Comparison | == != < > <= >= |
| Boolean / Logical | & | ^ |
| Bitwise / Shift | & | ^ << >> |
| Short-Circuit | && || |
| Ternary | Expr1 ? Expr2 : Expr3 |
22. Java Statements
A statement is a collection of expressions. Java statements are instructions that tell the programming language what to do.
Examples
double entryFee = 15.75; int a = 12;
Different Types of Statements
- General Purpose Statements
- Declaring variables, methods and classes
- Creating objects and accessing variables and methods
- Conditional statements
- Iterative statements
- Transfer statements
- Exception handling statements
- Synchronized statements
23. Quick Revision
| Topic | Key Point |
|---|---|
| Father of Java | James Gosling |
| Original Name | Oak |
| First Public Java | Java 1.0 in 1995 |
| WORA | Write Once, Run Anywhere |
| OOP | Uses objects, data and methods to structure programs. |
| OOP Features | Classes & Objects, Abstraction, Encapsulation, Inheritance, Polymorphism, Dynamic Binding, Composition. |
| Java Features | Platform independent, simple, object-oriented, distributed, portable, interpreted, high performance, multithreaded and dynamic. |
| Application Types | Standalone and distributed applications. |
| JDK Tools | javac, java, javap, javah, javadoc, jdb. |
| Tokens | Identifiers, literals, keywords/reserved words and operators. |
| Number Systems | Binary, Octal, Decimal and Hexadecimal. |
| Comments | Single-line, multi-line and documentation comments. |
| Statements | Instructions such as declarations, conditionals, loops, transfers, exception handling and synchronization. |
21. Java Comments
Single-Line Comment
Starts with two forward slashes.
Multi-Line Comment
Starts with
/*and ends with*/.Documentation Comment
The source gives the following author documentation format.