0% found this document useful (0 votes)
5 views

Java short notes

Java is a high-level, object-oriented programming language developed by Sun Microsystems, emphasizing platform independence through the Java Virtual Machine. Key concepts include classes and objects, inheritance, polymorphism, encapsulation, and abstraction, along with a robust exception-handling mechanism. Java features automatic garbage collection, built-in support for multithreading, and various security measures.

Uploaded by

Mohd
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Java short notes

Java is a high-level, object-oriented programming language developed by Sun Microsystems, emphasizing platform independence through the Java Virtual Machine. Key concepts include classes and objects, inheritance, polymorphism, encapsulation, and abstraction, along with a robust exception-handling mechanism. Java features automatic garbage collection, built-in support for multithreading, and various security measures.

Uploaded by

Mohd
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Java (Notes)

1. Introduction to Java:

• Java is a high-level, class-based, object-oriented programming language designed to


have as few implementation dependencies as possible.

• Developed by Sun Microsystems in 1991 and now owned by Oracle Corporation.

• Platform Independence: Java uses the "write once, run anywhere" philosophy, making
it platform-independent via the Java Virtual Machine (JVM).

2. Key Concepts in Java:

• Classes and Objects: Java is object-oriented, meaning everything is an object. A class


is a blueprint for objects, and an object is an instance of a class.

• Inheritance: Enables one class to inherit the properties and methods of another class.
Allows for code reusability.

• Polymorphism: The ability of a single function or operator to operate on different types


of objects. Achieved through method overloading and overriding.

• Encapsulation: Hides the internal state of an object and only exposes necessary
methods. Achieved using private variables and public getter/setter methods.

• Abstraction: Hides complex implementation details from the user. Can be achieved
using abstract classes and interfaces.

3. Java Syntax:

• Java programs consist of classes and methods.

• Every Java program begins with the main() method, which is the entry point of the
program.

public class HelloWorld {

public static void main(String[] args) {

System.out.println("Hello, World!");

4. Exception Handling:

• Java provides a robust exception-handling mechanism, allowing developers to handle


runtime errors and maintain program flow.

• Commonly used keywords: try, catch, throw, throws, finally.

try {

int result = 10 / 0;

} catch (ArithmeticException e) {
System.out.println("Error: " + e.getMessage());

} finally {

System.out.println("Finally block executed.");

5. Java Features:

• Garbage Collection: Automatic memory management ensures that objects not in use
are removed to free memory space.

• Multithreading: Java provides built-in support for multithreading, allowing concurrent


execution of two or more parts of a program.

• Security: Java includes a range of security features such as bytecode verification and
secure class loaders.

You might also like