Posts

Showing posts from February, 2017

java Logical Code

Java Logical code that is frequently asked in interview. Java Dilip,Delhi-9873303812 Logical Program ----------------------------------- Class Program1 { public static void main(String...arg) { int a = 10,b=20; System.out.println(a+b); - 30 System.out.println("Sum is - "+a+b); - Sum is 1020 System.out.println("Sum is - "+(a+b)); - Sum is 30 } } Q- what happen when compile & run it? class P1 { public static void main(String aa[]) { int a; System.out.println(a+10); } } 1- Compile & run - print 10 2- Compile Time error 3- compile but not run 4- None _________________________________________________________ class P2 { int a; public static void main(String aa[]) { System.out.println(a+10); } } 1- Compile & run - print 10 2- Compile Time error 3- compile but not run 4- None _________________________________________________________ class P3 ...