Lect-1C Intro To Java
Lect-1C Intro To Java
CS F213
Object Oriented Programming
10/01/24
Java Program
My first program
▪ void:
» Defines the return type, in this case it is void.
» The system locates and runs the main method for a class
when you run a program.
▪ String args[ ]
System.out.println
▪ println: It is a method
Blocks
▪ A pair of braces in a program form a block that groups
components of a program.
Comments
//my first java program
class myfirstjavaprogram
{
public static void main(String args[])
{
System.out.println("this is my first java
program");
}
}
Lexical constraints
List of Separators
Important points
▪ The name of the source file is very important.
▪ In previous example, the name of the file will be
myfirstjavaprogram.java
▪ The name of the class should match the name of file that holds
the program.
▪ A source file is officially called compilation unit.