Java basic Practical Programming (Part-4)

Java Programming quotes


                                    



Question 16 ):- print Char and Boolean value on Console.


class que

{

public static void main(String args[])
{
char c='A';
boolean f=true;
System.out.println("Character value :" + c);
System.out.println("Boolean value :" + f);
}
}



Question 17 ):- Explicit conversion of values.


class que

{
public static void main(String args[])
{
int a=(int)28;
float b=(float)23.7;
double c=(double)234.56;
System.out.println("Integer Value :" + a);
System.out.println("Float Value :" + b);
System.out.println("Double Value :" + c);
}
}

Question 18 ):- Program to check if two variables have same value .


class que

{
public static void main(String args[])
{
int a=10,b=10;
System.out.println("A =" + a);
System.out.println("B =" + b);
if(a>b)
{
System.out.println("A Is Max !");
}
else if(b>a)
{
System.out.println("B Is Max !");
}
else
{
System.out.println("A And B Is Both Equal !");
}
}
}


Question 19 ):-Program to store Pi value, radius and calculate area for the circle.


class que
{
public static void main(String args[])
{
double pi=3.14;
int r=5;
System.out.println("Area Of Circle Is :" + (pi*(r*r)));
}
}



Question 20 ):-Program to store Length and Breadth value, and calculate area for the rectangle.


class que
{
public static void main(String args[])
{
int length=10,breadth=20;
System.out.println("Area of rectangle Is :" + (length*breadth));
}
}


Next Programs is coming Soon.... so stay Connected with us ThankYou ✌✌ .






Post a Comment

0 Comments