Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: REVISION QUESTIONS!!

  1. #1
    Junior Member
    Join Date
    Jul 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default REVISION QUESTIONS!!

    would any1 be soo kind enuff to answer these questio for mee i have not a clue.. iv underlined what i deem too bee correct
    Questions 1.15 to 1.19 refer to the following section of Java code:-

    public class xxx{
    public int aaa ;
    private String bbb;
    public xxx(){ }
    public int ddd(double eee) { }
    public void fff(int ggg){ }
    }
    public class yyy extends xxx{
    private double hhh;
    public yyy( ) { }
    private String zzz() { }
    }

    1.15 Which one of the following is the correct form of creating an instance of class yyy:-

    A z = new yyy();
    B z = new(yyy);
    C z = yyy new();
    D z = new.yyy();
    E z = yyy.new();

    1.16 Given that z is an instance of yyy. Which one of the following Java statements is valid:-

    A int s = z.ddd(3.0);
    B int s = yyy.ddd();
    C int s = xxx.ddd(3.0);
    D int s = ddd(z);
    E int s = z.ddd();

    1.17 Given that x is an instance xxx. Which one of the following Java statements is invalid:-

    A x.fff(3);
    B x.aaa = 3;
    C int i = x.aaa + 3;
    D x.hhh = 3.0;
    E double r = x.ddd(3.0);

    1.18 Given that z is an instance of yyy. Which one of the following Java statements is invalid:-

    A z.fff(2);
    B z.aaa = 123;
    C double a = z.hhh();
    D int r = z.ddd(2.0) + 2;
    E int f = z.aaa + 2;

    1.19 Which one of the following statements about this scenario is incorrect:-

    A yyy is a subclass of xxx
    B xxx is the superclass of yyy
    C yyy inherits aaa from xxx
    D xxx inherits bbb from yyy
    E each subclass has its own constructor

    and ....

    Questions 1.15 to 1.19 refer to the following section of Java code

    public class XXX {
    public int a;
    private double b;
    public void c(int d) { }
    }
    public class YYY extends XXX {
    public int d;
    private double e(String f) { }
    }

    1.15 Which one of the following is the correct form of creating an instance of class YYY:-
    A YYY z = new(YYY);
    B XXX z = XXX.new;
    C YYY z = new YYY();
    D XXX z = YYY.new();
    E YYY z = YYY(new);

    1.16 Given that y is an instance of YYY.
    Which one of the following Java statements is valid:-
    A y.d = 123.4;
    B y.e("Fred");
    C String x = y.a;
    D y.c(3);
    E double x = y.e;

    1.17 Given that x is an instance XXX.
    Which one of the following Java statements is invalid:-
    A int p = x.a + 9;
    B int p = x.d;
    C x.c(9);
    D x = new XXX( );
    E double b = x.a + 9.9;

    1.18 Given that z is an instance of YYY.
    Which one of the following Java statements is invalid:-
    A z.b = 123.4;
    B z.d = 1234;
    C z.c(1234);
    D int r = z.a + 9;
    E double r = z.a + 9.9;

    1.19 Which of the following statements about this scenario is incorrect:-
    A Objects of class YYY inherit attribute a
    B YYY is a subclass of XXX
    C c( ) is a method of objects of class YYY
    D Both classes have different constructor methods
    E Objects of class XXX inherit method e( )
    Last edited by nav1407; July 19th, 2011 at 06:12 PM. Reason: added my answers


  2. #2
    Forum old-timer
    Join Date
    Nov 2008
    Location
    Faversham, Kent, UK
    Posts
    471
    My Mood
    Mellow
    Thanks
    4
    Thanked 58 Times in 54 Posts

    Default Re: REVISION QUESTIONS!!

    If you give us your answers and explain why you think they're right, we'll try to help you if you get them wrong.

    I don't really see how just telling you the answers is going to help you learn to figure out how to answer them yourself...

  3. #3
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,514
    My Mood
    Grumpy
    Thanks
    0
    Thanked 165 Times in 156 Posts

    Default Re: REVISION QUESTIONS!!

    Improving the world one idiot at a time!

  4. #4
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 287 Times in 225 Posts
    Blog Entries
    4

    Default Re: REVISION QUESTIONS!!

    What are these questions for please? Is it a graded homework test or just for fun?
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

    Looking for a Java job? Visit - Java Programming Careers

Similar Threads

  1. JTextPane questions.
    By sunde in forum AWT / Java Swing
    Replies: 1
    Last Post: March 28th, 2011, 03:18 PM
  2. Many questions
    By SharpT in forum What's Wrong With My Code?
    Replies: 11
    Last Post: January 18th, 2011, 08:56 PM
  3. Date Of Birth Revision , Class please help
    By youssef22 in forum Object Oriented Programming
    Replies: 2
    Last Post: November 6th, 2010, 02:41 AM
  4. A few questions
    By adenverd in forum Java Theory & Questions
    Replies: 3
    Last Post: May 26th, 2010, 03:34 AM
  5. [SOLVED] Some serious questions,
    By Time in forum What's Wrong With My Code?
    Replies: 3
    Last Post: May 17th, 2010, 02:52 AM

Tags for this Thread