Assignment-1(core java)

 If we compile and run the following code snippets, what will be happen?

1) int true =10;                    
    System.out.println(true);

2) int True=20;
    System.out.println(True);

3) byte a=10;
    short b=a;
    System.out.println(b);

4)short a=10;
    byte b=a;
    System.out.println(b);

5)short a=10;
    byte b=(byte)a;
    System.out.println(b);

6) char a='A';
    int b=a;
 System.out.println(b);

7)char a='A';
    int b=(int)a;
 System.out.println(b);

8)int a=67;
 char b=a;
 System.out.println(b);

9)int a=78;
char b=(char)a;
 System.out.println(b);

10)char Char="A";
 System.out.println(Char);

11)boolean a=true;
boolean b=false;
boolean c=a+b;
System.out.println(c);

12)double a=3.5;
int b=3;
float c=(float)a+b;
System.out.println(c);

13) float a=3.5f;
char b= 'a';
int c=(int)(a+b);
System.out.println(c);

14)char a='A';
short b=5;
char c=(char)(a+b);
System.out.println(c);









Comments

Popular posts from this blog

Inheritance in Java

Type Conversions

Life cycle of a Thread and creating thread class