The Artima Developer Community
Sponsored Link

Java Answers Forum
Any Java Source for 16 questions

1 reply on 1 page. Most recent reply: Mar 9, 2006 10:53 PM by Matthias Neumair

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
Norm Frier

Posts: 2
Nickname: norm
Registered: Mar, 2006

Any Java Source for 16 questions Posted: Mar 9, 2006 12:42 PM
Reply to this message Reply
Advertisement
I have been assigned to complete 45 questions using any Java source avaialble. I have found all except 16 of them in my Java book. This source was mentioned by the instructor as available. Could you please spend a minute to T or F them?

1. T or F. Static methods must be declared before dynamic methods in a class.

2. T or F. Static methods can access static variables of a class, but instance methods cannot.

3. T or F. You can override instance methods in a subclass.

4. T or F. If b is of class B and doit() is an instance method defined in B, then b.doit() always refers to the doit() from class B.

5. T or F. Static methods cannot access the private instance variables of of an object, but they can access the public instance variables.

6. T or F. More than one class can exist in a file, but classes cannot be nested.

7. T or F. Instance variables can be initialized when they are declared.

8. T or F. Local variables do not have an initial value by default.

9. T or F. A Java class can inherit from two unrelated classes.

10. T or F. A Java class can implement two unrelated interfaces.

11. T or F. Two classes cannot be defined in the same file since that would mean the file would have to have two different names.

12. T or F. Vectors may vary in size up to a fixed upper bound.

13. Effective use of vector elements requires casting.

14. Explain what super() does.

15. Explain what super(m) does.

16. Explain what super.print() does.

Thank you!


Matthias Neumair

Posts: 660
Nickname: neumi
Registered: Sep, 2003

Re: Any Java Source for 16 questions Posted: Mar 9, 2006 10:53 PM
Reply to this message Reply
Well, would you actually TRY to do something wrong, most of the questions would be abvious.

So I give you SOME answers, but for most I give you a hint how to find the answers


1 Just try it
2 Just try it
3t you can override anything public or protected
4 What if a class extending B was assigned to b and this class overrides the method?
5 Just try it, put the static method in the same class where the private variables are
6 May be I don'T undertand this right, but try to create a class inside a class
7t Trick questions: You can do this in the same program line, but during runtime they are created before calling the super constructor, but initialized after calling the super constructor. Since most people don't know this, the answer is T
8 primitive variables do (they are set to 0), Object variables don't. The compiler will give you an error for primitives, too. So the answer is T.
9 Try to use the "extends" tag in the headerr listing 2 classes
10 Try to use the "implents" tag in the header for 2 interfaces
11 What about inner classes? For 2 independent classes: Depends on the class loader. Try to do this with the default class loader (create 2 classes in one file and try to compile it)
12 I assume it's thrue that you can only add 2^16 or 2^32 elements, but you will never encounter this barrier.
For 14 and 15 look in the chapter about constructors.
For 16 look in the chapter about "extending classess"

Flat View: This topic has 1 reply on 1 page
Topic: problem in moving file in solaris platform by java. Previous Topic   Next Topic Topic: HELP ME!!! -- application development of lips recognition using ANN

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use