Control Statements and Operators

Today was about operators and control statements

 

Operators:

  1. Arithmatic : +,-,*,/,%,++,–,+=,-=,/=,*=,%=
  2. Relational: >,<,>=,<=,=,!=
  3. Bitwise
  4. Boolean Logical

 

Control Statements

  1. Selection statements
  • If else
  • Switch
  1. Iteration
  • while
  • do while
  • for
  1. Jump
  • break
  • continue

import java.util.Scanner;

 

class Ss

{

public static void main(String s[])

{

System.out.println(“Enter a number from 1-7”);

Scanner r= new Scanner(System.in);

int d=r.nextInt();

do

{

System.out.println(“Yes”);

d++;

} while(d<7);

}

}

 

 

 

 

class Sel

{

public static void main(String s[])

{

if(s[0].equals(“0”))

{

System.out.println(“VOTER AGE IS VALID”);

}

else

{

System.out.println(“VOTER AGE IS INVALID”);

}

}

}

Advertisements

Constructive and genuine appreciation and/or criticism most welcome

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s