Tag: programming languages
Questions Related to programming languages
What is the result of trying to compile and run this program. public class Test{ public static void main(String[] args){ int[] a = {1}; Test t = new Test(); t.increment(a); System.out.println(a[a.length - 1]); } void increment(int[] i){ i[i.length - 1]++; } }
What will happen if you try to compile and run this ? public class Test{ static{ print(10); } static void print(int x){ System.out.println(x); System.exit(0); } }
The following code is legal? long longArr[]; int intArr[] = { 7 ,8 , 9}; longArr = intArr;
The range of a byte is from -127 to 128.
Identify the invalid assignments.
What is the result of trying to compile and run the following code. public static void main(String[] args){ double d = 10 / 0; if(d == Double.POSITIVE_INFINITY) System.out.println("Positive infinity"); else System.out.println("Negative infinity"); }
What attributes do all real world objects have?
What is another name for creating an object?
String strA; String strB = new String("Cheese"); How many objects have been created in the above code snippet?
Short-circuit parameters are && and ||