Professional Documents
Culture Documents
Welcome To Java
Welcome To Java
Welcome To Java
• The answer is we use a programming language which can human understand but
computers not because computers understand only as I told you guys Machine language .
• So what happens then ha ?
• The thing is that the programming language which we are using is being translated or
converted by compiler or interpreter to Machine language .
• In this way computers understand our language .
WHAT IS JAVA ?
• The line 3 starts with System.out.println which prints out our desired data on the screen .
• The right curly bracket means our main method ends here.
• And the other curly bracket means our Class ends here.
VARIABLE
}
}
VARIABLE
• When we write the name of variable with data type, this is called Variable declaration.
int a ;
// variable declaration
• Here the int means integer data type just like 1,2,3,4,5,6,7,8,9 and 10 etc.
• The semi colon “ ; “ is a statement terminator which means here our statement ends.
• The double forward slash is a single line comment.
VARIABLE INITIALIZATION
a = 10 ;
// variable initialization
VARIABLE INITIALIZATION
• When we store a specific value in a variable , then this is called variable initialization.
• We can declare variable and initialize variable just in one statement rather than writing
two statements just like that :
int a = 10 ;
DATA TYPES
int a = 10 ;
DATA TYPES
float a = 10.5F;
System.out.println(a);
DATA TYPES
char a = 'n' ;
char b = 'N' ;
char c = '1' ;
char d = '$' ;
DATA TYPES
• By structure of program means , that in how many way we can write a program.
• There are three basic structure of program according to Jaccopini means that each
computer program, we can write In three ways.
• These structure are given as :
1) Sequence structure
2) Control structure
3) Iteration structure
SEQUENCE STRUCTURE
import java.util.Scanner;
public class Main {
public static void main (String[] args)
{
int a = 6 ;
int b = 4 ;
int c = a + b ;
System.out.printf("Your sum is %d",c);
}
}
SEQUENCE STRUCTURE