Advertisement
Guest User

Quiz Costruttore

a guest
Feb 13th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.71 KB | None | 0 0
  1. //What will be the result of attempting to compile the following program?
  2. public class TestClass{
  3. long l1;
  4. public void TestClass(long pLong) { l1 = pLong ; } //(1)
  5. public static void main(String args[]){
  6. TestClass a, b ;
  7. a = new TestClass(); //(2)
  8. b = new TestClass(5); //(3)
  9. }
  10. }
  11. /* Select 1 option
  12. A. A compilation error will be encountered at (1), since constructors should not
  13. specify a return value.
  14. B. A compilation error will be encountered at (2), since the class does not have a
  15. default constructor.
  16. C. A compilation error will be encountered at (3).
  17. D. The program will compile correctly.
  18. E. It will not compile because parameter type of the constructor is different than the
  19. type of value passed to it.*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement