• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

sample sun test

 
Basu Patel
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone answer the following qns. for me , thank you
2.What should you use to position a Button within an application Frame so that the size of the Button is NOT affected by the Frame size?
A.a FlowLayout
B.a GridLayout
C.the center area of a BorderLayout
D.the East or West area of a BorderLayout
E.the North or South area of a BorderLayout

3. Which is the advantage of encapsulation?
A.Only public methods are needed.
B.No exceptions need to be thrown from any method.
C.Making the class final causes no consequential changes to other code.
D.It changes the implementation without changing the interface and causes no consequential changes to other code.
E.It changes the interface without changing the implementation and causes no consequential changes to other code.

5. Which statement is true about a non-static inner class?
A.It must implement an interface.
B.It is accessible from any other class.
C.It can only be instantiated in the enclosing class.
D.It must be final if it is declared in a method scope.
E.It can access private instance variables in the enclosing object.
 
Anuj Saxena
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think ....
Answer to Q1 -> a)
I think it is (a) because a FLowLayout Manager honors the component's preferred size.

Answer to Q2 -> d)
I think it is (d) because encapsulation allows you to perform maintenance on your code without causing any other code that uses these variables or methods to be rewritten.
Answer to Q3 -> e)
The other 4 are not really required for inner classes... as far as I know.
Could someone verify my answers please? Thanks
Anuj
 
Jeff Holmes
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree with the answers.
 
Sanjeev Verma
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ditto!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic