Question

Question 1 True or False: In a class-based object oriented language (like Java) classes define types...

Question 1

True or False: In a class-based object oriented language (like Java) classes define types of objects - including the things these object know and the things these objects can do.

True
False

Question 2

The Java keyword new is used for what purpose?

to reset an object to its default state
to declare a variable
to clear all local variables
to declare or define a method
to instantiate an object of a class

Question 3

True or False: The purpose of a constructor is to initialize an object into a valid state.

True
False

Question 4

True or False: A constructor method is guaranteed to execute when an object is instantiated.

True
False

Question 5

Consider the following Java class declaration. How many methods are defined in this class?

class Bunny {
    int age;
    String name;

    void hop() {
        System.out.println(name + " hops around.");
    }

    void eat(String food) {
        System.out.println(name + " eats the " + food + ".");
    }

    void sleep() {
        System.out.println(name + " takes a nap.");
    }
}
0
1
2
3
4
0 0
Add a comment Improve this question Transcribed image text
Answer #1
Question 1:
True

Question 2:
to instantiate an object of a class

Question 3:
True

Question 4:
True

Question 5:
3

Add a comment
Know the answer?
Add Answer to:
Question 1 True or False: In a class-based object oriented language (like Java) classes define types...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT