Java Practicals Printready
Java Practicals Printready
Java Practicals Printready
class ifdemo {
int x = 5;
int y = 10;
if (x == 5 && y == 10) {
if (x < y || x == 5) {
}
2)Write any program to check even or odd.
import java.util.*;
class evenoddpj
int n;
System.out.println("Enter number:");
n=sc.nextInt();
if(n%2==0)
else
}
Q1.) Write a programme to check switchcase.
import java.util.Scanner;
class switchit
char ch = pj.next().charAt(0);
switch(ch)
case 'a':
case 'e':
case 'i':
case 'o':
case 'u':
case 'A':
case 'E':
case 'I':
case 'O':
case 'U':
default:
break;
}
5.2. Write any program to print pyramids of Star/patterns using increment/decrement.
class donger
int i,j,num=7;
System.out.print("* ");
System.out.println();
}
6.2) Write a program to display number 1to50 using do-while loop.
class dowhilepj{
int i = 1;
do {
System.out.println(i);
i++;
}
9.2. Write a program to convert variable basic data type and show the result of explicit
typecasting
class explicit
}
7-8.3. Write a program to implicitly typecast lower range data type to larger storage size
datatype.
class implicitpj
byte b = 6;
short s = b;