1 | class Etattva
{
int a, c ;
{ a= 10;
System.out.println( this .b);
c = a * b ;
}
int b=20;
private Etattva()
{ b=30;
System.out.println( c) ;
}
public static void main(String s[])
{ Etattva obj= new Etattva();
obj. show();
}
void show()
{ System.out.println(a); }
}
What is the output of the Program? Select one correct answer.
|
2 | class ParentEtattva
{ static
{ System.out.print( ParentEtattva.a + " ");
}
static int a=30;
ParentEtattva()
{ System.out.print ( a+ " "); }
}
public class Etattva extends ParentEtattva
{
private static int show( int str )
{ System.out.print ( str+ " " );
return str ;
}
private Etattva ( )
{ super.a =40;
s1= show (10);
}
{
s1= show (40);
}
int s1 = show (20 );
public static void main( String s[ ] )
{ ParentEtattva obj = new Etattva(); }
};
|
3 |
1. class ParentEtattva
2. {
3. private ParentEtattva() throws Exception
4. { show();
5. }
6. public void show()throws ArithmeticException ,java.io.IOException
7. { System.out.println("This is Parent Etattva show");
8. throw new java.io.IOException();
9. }
10. };
11. public class Etattva extends ParentEtattva
12. {
13. public void show()throws java.io.FileNotFoundException
14. {
15. System.out.println(" This is Child Etattva show") ;
16. }
17. public static void main(String s1[ ] )throws Exception
18. { ParentEtattva obj= new Etattva( );
19. obj.show();
20. }
21. }
Which line cause Compilation in the Program? Select one correct answer
|
4 |
1.class Etattva
2. {
3. public static void main(String s[] ) throws Exception
4. {
5. try
6. { new Etattva().show();
7. }
8. catch(Throwable e)
9. {System.out.println("Can I Catch The Error ?");
10. }
11. finally
12. { System.out.println(" I can never be executed");
13. }
14. }
15. public void show() throws Error
16. { System.out.println( " hi am show function ");
17. throw new Error();
18. }
19. };
|
5 |
What is true about Custom Exception. Select two correct answer |
6 | 1. class Etattva
2. {
3. public static void main(String s[] ) throws Exception
4. {
5. new Etattva(). finalize(10);
6. new Etattva().finalize();
7. }
8. protected void finalize()
9. {
10 System.out.println(" Memory relocated " );
11. }
12. protected void finalize(int i)
13. {
14. System.out.println(" New Finalize method " + I[ 0 ]);
15. }
16. }
What is true about above Program? |
7 | 1. class ParentEtattva
2. {
3. static int a=10;
4. void show(int j )
5. { System.out.println( " This is Parent Show " + j ); }
6. };
7. class Etattva extends ParentEtattva
8. {
9. public static void main( String s2 [ ] )
10. {
11. Byte b = (byte) 20 ;
12. ParentEtattva obj [ ] = new Etattva[5 ];
13. obj [0] = new Etattva();
14. obj[1] = new ParentEtattva();
15. obj[1].show(a);
16. obj[0].show(b);
17. }
18. void show(Integer i )
19. {
20. System.out.print(" " + i + " " );
21. }
22. }
What is the Output of the Program? Select one Correct program. |
8 | The read() method of which of these class does throw an IOException ? Select one correct answer. |
9 |
1. class Outer1
2. {
3. int x=10;
4. public static int y=20;
5. Outer1()
6. { System.out.println ("Hi this is Outer 1 cons " );
7. }
8. void show()
9. { System.out.println ("This is Outer show ");
10. }
11. public static void disp()
12. { System.out.println ("Outer Display");
13. }
14. static class Inner1
15. { Inner1()
16. {System.out.println("This is Inner Constructor");
17. }
18. void show()
19. { System.out.println("this is Inner show "+ y); }
20. }
21. };
22. class Etattva extends Outer1.Inner1
23. {
24. public static void main(String s[])
25. {
26. Etattva obj = new Etattva ();
27. Outer1.Inner1 object = new Outer1.Inner1 ();
28. object. show ();
29. obj. show ();
30. object. disp ();
31. System.out.println ( obj1.y );
32. System.out.println ( obj.x );
33 System.out.println( Outer1.Inner1.y );
34. }
35. };
Which is the First line in the program that cause compilation error ? Select one correct answer. |
10 |
class Etattva
{
public void show( )
{ class Local
{
public void show()
{ System.out.println("This is show Local show ");
}
};
}
public void disp()
{ class Local
{
public void disp()
{ System.out.println(" This is disp Local show");
}
};
}
};
What is the name of the .class Files of Local classes when this program is compile ? Select two Correct answer.
|