Java MT 5

Card Set Information

Author:
gianni11
ID:
207419
Filename:
Java MT 5
Updated:
2013-03-16 01:41:01
Tags:
MT pp9 10
Folders:

Description:
MT 5 pp9 & 10
Show Answers:

Home > Flashcards > Print Preview

The flashcards below were created by user gianni11 on FreezingBlue Flashcards. What would you like to do?


  1. What is a constructor?
    used to perform operations at the time an object is created.

    • public Rectangle(double len, double w)
    • {
    • length = len;
    • width = w;
    • }
  2. Constructors have the same name as the _______
    class
  3. Constructors have no ___________
    return type
  4. A constructor that doesn't accept arguments is a ______________
    no-arg constructor.
  5. What does a no-arg constructor look like?
    • public Rectangle(){
    • length = 0.0;
    • width = 0.0;
    • }
  6. What is method overloading?
    Two or more methods in a class have the same name.

    public int add(int num1, int num2)

    public String add (String str1, String str2)
  7. A __________ consists of the method’s name and the data types
    method signature

    add(int, int)
  8. The process of matching a method call with the correct method is known as ________ .
    binding
  9. What is Shadowing
    Method with a local variable with the same name as an Instance Field.
  10. What does the toString method do?
    returns the class name and a hash of the memory address of the object.
  11. the _________ method is usually called implicitly when passing to _________ or concatenating.
    toString

    println
  12. when the == operator is called, the __________ are compared.
    memory addresses.
  13. How is the == method overridden?
    public boolean equals(Stock object2) {

    boolean status;

    • if(symbol.equals(Object2.symbol)
    • && sharePrice == Object2.sharePrice)
    •    status = true;

    • else
    • status = false;
    • return status;
    • }
  14. The purpose of overriding the == method is to ___________
    Compare by contents rater than addresses.

What would you like to do?

Home > Flashcards > Print Preview