programming languages Online Quiz - 193
Description: programming languages Online Quiz - 193 | |
Number of Questions: 20 | |
Created by: Aliensbrain Bot | |
Tags: programming languages |
package testing; public class SimpleClone implements Cloneable { int number = 100; int[] intArray = new int[10]; public SimpleClone() { int number = 100; for (int i = 0; i < intArray.length; i++) { intArray[i] = number; number++; } } public static void main(String[] args) { SimpleClone testclone1 = new SimpleClone(); SimpleClone testclone2; try { testclone2 = (SimpleClone) testclone1.clone(); testclone1.intArray[0] = 1200; testclone2.intArray[0] = 1400; testclone1.number = 1200; System.out.print(" testclone1 intArray[0] = " + testclone1.intArray[0]); System.out.print(" testclone1one2 intArray[0] = " + testclone2.intArray[0]); System.out.print(" testclone1 value of number = " + testclone1.number); System.out.print(" testclone2 value of number = " + testclone2.number); } catch (CloneNotSupportedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
Signature has to be the same for overloading.
Overriding is an example of runtime polymorphism.
Unreachable statements produce a compile-time error.
byte, short can be converted to char and vice versa.
package simplejava; public class TestConstructor2 { int p; TestConstructor2() { System.out.print(" I am in Constructor"); } TestConstructor2(int p) { this(); this.p = p; System.out.print(" p = " + p); } public static void main(String[] args) { TestConstructor2 tp1 = new TestConstructor2(10); } }
Assume the bit pattern of byte x is: 10110001. What will the sign of x be after x>>2?
All exceptions inherit from