JAVA UNIT 1,2,3 Syllabus
Java Programming Constructs:
Variables:
In Java, a variable is a container for storing data values. It has a data type and a
name.
Primitive Data Types:
Java has eight primitive data types, including int, short, long, byte, float, double,
char, and boolean.
Identifier:
An identifier is a name given to a variable, method, class, etc., in Java. It must start
with a letter, underscore (_), or dollar sign ($) and can be followed by letters,
digits, underscores, or dollar signs.
Literals:
Literals are constant values assigned to variables. Examples include integer literals,
floating-point literals, character literals, and string literals.
Operators:
Java supports various operators, such as arithmetic, relational, logical, bitwise,
and assignment operators.
Expressions:
An expression is a combination of variables, operators, and literals that evaluates
to a single value.
Precedence Rules and Associativity:
Precedence rules determine the order of evaluation of operators in an expression.
Associativity defines the direction in which operators with the same precedence
are evaluated.
Primitive Type Conversion and Casting:
Primitive type conversion involves converting one primitive data type to another.
Casting is explicitly converting a variable from one data type to another.
Flow of Control:
Flow of control in Java includes decision-making (if-else statements), looping (for,
while, do-while loops), and branching (break, continue).
Classes and Objects:
Class, Objects, Class Declaration in Java, Creating Objects:
A class is a blueprint for objects. Objects are instances of a class. Class declaration
involves specifying class members such as fields, constructors, and methods.
Methods, Constructors, Cleaning Up Unused Objects:
Methods are functions within a class. Constructors initialize objects. Cleaning up
unused objects involves using the garbage collector to reclaim memory.
Class Variable and Methods - Static Keyword:
Static variables and methods belong to the class rather than instances. They are
shared among all objects of the class.
this Keyword:
The 'this' keyword refers to the current instance of a class. It is used to
differentiate instance variables from local variables.
Arrays:
One-dimensional, Two-dimensional:
Arrays in Java can be one-dimensional or multi-dimensional. One-dimensional
arrays are like lists, while two-dimensional arrays are like tables.
Using For..each with Array:
The for-each loop simplifies iterating through arrays.
Passing Arrays to Methods and Returning Arrays from Method:
Arrays can be passed as parameters to methods, and methods can return arrays.
Command Line Arguments:
Java programs can accept command line arguments as input parameters during
execution.
Inheritance:
Deriving Classes Using 'extends' Keyword:
Inheritance allows a class (subclass/derived class) to inherit properties and
behaviors from another class (superclass/base class).
Overriding Method:
A subclass can provide a specific implementation of a method defined in its
superclass.
'super' Keyword, 'final' Keyword:
'super' is used to access members of the superclass. 'final' prevents modification
of classes, methods, or variables.
Abstract Class:
An abstract class cannot be instantiated and may contain abstract methods, which
must be implemented by its subclasses.
Interface:
Variables in Interface:
Interfaces can have constants (implicitly public, static, and final).
Extending Interfaces:
Interfaces can extend other interfaces, forming a hierarchy.
Interface vs Abstract Class:
Interfaces provide a form of multiple inheritance, while abstract classes allow a
mix of concrete and abstract methods.
Packages:
Creating Packages:
Packages organize classes into a hierarchical structure.
Using Packages:
Classes in one package can be accessed by classes in another package using
import statements.
Access Protection:
Access modifiers (public, private, protected) control the visibility of classes,
methods, and variables.
java.lang Package:
java.lang.Objects Class:
The Objects class provides utility methods for object manipulation.
java.wrapper Classes:
Wrapper classes provide a way to use primitive data types as objects.
String Class:
The String class represents sequences of characters and provides various methods
for string manipulation.
String Buffer Class:
The StringBuffer class is a mutable sequence of characters, allowing dynamic
modification of strings.
Exception:
Introduction:
Exceptions in Java are events that occur during the execution of a program that
disrupts the normal flow of instructions.
Exception Handling Techniques:
Java provides try-catch blocks for handling exceptions, ensuring graceful program
termination.
User-Defined Exception:
Developers can create custom exception classes by extending the Exception class.