Sei sulla pagina 1di 13

Java

Programming Language
• What is machine language?

• What is high level programming language?

• What is compiler?

• What is interpreter?
Layers of Languages
Try to guess what it means?
Try to guess what it means?
System.out.println("Enter the Height");
Scanner sc1 = new Scanner(System.in);
int side1 =sc1.nextInt();
System.out.println("Enter the width");
Scanner sc = new Scanner(System.in);
int side2 = sc.nextInt();
int area;
if (side1==side2){
area = side1*side1;
System.out.println("Area of Square is :"+area);
}
else{
area=side1*side2;
System.out.println("Area of rectangle is :"+area);
}
Create and Run The Program in
NetBeans
Create and Run The Program in
NetBeans
Create and Run The Program in
NetBeans
Syntax Rules
• ;
• //
• /* .... */
• Variable declaration
• {}

Write something about each one of these, if you can


What is int /
void

What is
Public?

What is Static?
Guess the output
class TestStringConcatenation2{
public static void main(String args[]){
String c="5";
String d="3";
String s=c+d;
System.out.println(s);//
}
}
Fill in the Blanks
int x=1;
while (x< ___){
System.out.print("Cool");
System.out.println("Java");
x=x+1;

}
if(x==____){
System.out.println("Yo");
}
O/P= CoolJava
CoolJava
Yo
Will this programme run correctly?
public class LargerNumber {
public static void main (String args[]){
int x=1;
while (x<10){
if(x==1){
System.out.println("Value of x is:"+x);
}
}
}
}

If not, what might be error?

Potrebbero piacerti anche