Professional Documents
Culture Documents
CS 2nd Lec #03
CS 2nd Lec #03
CS 2nd Lec #03
Class Declaration:
Main Method:
This declares the main method, which is the entry point of any Java
application.
When you run the program, the execution starts from this method.
The public static void part indicates that this method is:
public: Accessible from anywhere in the program.
static: Can be called without creating an object of the class.
void: Doesn't return any value.
CS 2nd Lecture No :#03 (OOP)Object Oriented
Output Statement:
Identifiers:
Identifiers are unique names you give to program elements like
variables, functions, classes, and packages.
They follow specific naming conventions:
Variables:
Example:
Assignments:
Statements:
Statements are complete instructions that the program can execute.
They perform actions like:
Declaring variables
Performing calculations
Controlling program flow (e.g., using if statements for conditional
execution)
Interacting with the user (e.g., printing messages or reading input)
Examples:
Assignment Expressions:
Named Constants: