Using Classes

Using Classes

Assessment

Flashcard

Computers

12th Grade

Hard

Created by

Jeffrey Smith

FREE Resource

Student preview

quiz-placeholder

9 questions

Show all answers

1.

FLASHCARD QUESTION

Front

Shoes shoe1 = new Shoes();

Back

public Shoes(){

brand = "Nike"

size = 7;

}

2.

FLASHCARD QUESTION

Front

Shoes shoe2 = new Shoes("Adidas");

Back

public Shoes(String brand){

this.brand = brand;

size = 7;

}

3.

FLASHCARD QUESTION

Front

Shoes shoe1 = new Shoes(){

System.out.println(shoe1);

Ouput: Brand: Nike Size: 7

Back

public String toString(){

return "Brand: " + brand + " Size: " + size;

}

4.

FLASHCARD QUESTION

Front

System.out.println(shoes1.getBrand());

Back

public String getBrand(){

return name;

}

5.

FLASHCARD QUESTION

Front

shoes1.setSize(10);

Back

public void setSize(int size){

this.size = size;

}

6.

FLASHCARD QUESTION

Front

shoes1.setBrand("Puma");

Back

public void setBrand(String brand){

this.brand = brand;

}

7.

FLASHCARD QUESTION

Front

System.out.println(shoes1.getSize());

Back

public int getSize(){

return size;

}

8.

FLASHCARD QUESTION

Front

Shoes shoe3 = new Shoes("Reebok", 9);

Back

public Shoes(String brand, int size){

this.brand = brand;

this.size = size;

}

9.

FLASHCARD QUESTION

Front

shoes1.addOneToSize();

Back

public void addOneToSize(){

size++;

}