Home
Browse
Create
Search
Log in
Sign up
Upgrade to remove ads
Only $2.99/month
AP COMPSCI Abstract
STUDY
Flashcards
Learn
Write
Spell
Test
PLAY
Match
Gravity
Terms in this set (18)
All methods in an interface are automatically public.
Which statement about methods in an interface is true?
Interfaces have both private and public methods.
Which of the following statements about interfaces is NOT true?
A class can implement only one interface type.
Which of the following statements about interfaces is NOT true?
LARGE_CHANGE and SMALL_CHANGE are automatically public static final.
Consider the following code snippet:
public interface Sizable
{
int LARGE_CHANGE = 100;
int SMALL_CHANGE = 20;
void changeSize();
}
Which of the following statements is true?
You can convert from a class type to any interface type that the class implements.
Which of the following is true regarding a class and interface types?
You can define an interface variable that refers to an object only if the object belongs to a class that implements the interface.
Which of the following statements about interfaces is true?
Overloading
____ occurs when a single class has several methods with the same name but different parameter types.
polymorphism
Consider the following code snippet:
public class Demo
{
public static void main(String[] args)
{
Point[] p = new Point[4];
p[0] = new Colored3DPoint(4, 4, 4, Color.BLACK);
p[1] = new ThreeDimensionalPoint(2, 2, 2);
p[2] = new ColoredPoint(3, 3, Color.RED);
p[3] = new Point(4, 4);
for (int i = 0; i < p.length; i++)
{
String s = p[i].toString();
System.out.println("p[" + i + "] : " + s);
}
return;
}
}
This code is an example of ____.
You cannot change the name, return type, or parameters of a method in the interface.
Which of the following can potentially be changed when implementing an interface?
3
A class that implements Locatable has to at least have how many methods?
public interface Locatable
{
int getX();
int getY();
double getSpeed();
}
public
All methods located inside of an interface are automatically set with what access?
abstract
All methods located inside of an interface are automatically labeled with which of the following modifiers?
private void setScore(double s);
Which of the following could not fill <blank 1>?
public interface Testable
{
<blank 1>
}
1
A class can extend how many other classes?
as many as you want
A class can implement how many other interfaces?
1
What is the minimum number of methods a class extending abstract class Demo could have?
public abstract class Demo
{
public abstract String destroy();
}
super(s,c);
super("34234",7);
Assuming <blank 1> is filled correctly, which of the following could fill <blank 2> to make a call the parent two parameter constructor?
public abstract class APlayer
{
private ArrayList<String> stuff;
private int scnt;
public APlayer()
{
//code not shown
}
public APlayer(String stuff, int count)
{
//code not shown
}
public int getStuffCount()
{
return scnt;
}
public <blank 1> void play();
}
public class Player extends APlayer
{
public Player()
{
super();
}
public Player(String s, int c)
{
<blank 2>
}
public void play()
{
//code not shown
}
}
public class ThePlayer extends APlayer
{
public ThePlayer()
{
}
public void play()
{
//code not shown
}
}
//code in the main method of another class
<blank 3> //make a variable
<blank 4> //call a method on the variable
private static int a;
private static int b=9;
Which of the following could be placed in CheckIt?
public abstract class CheckIt
{
}
THIS SET IS OFTEN IN FOLDERS WITH...
leanderisd 8th math - Proportionality - Similarity
7 terms
Vocabulary Unit # 1
20 terms
Vocabulary Unit # 2
20 terms
Exprésate 2: Capítulo 2 (Lista 1)
49 terms
YOU MIGHT ALSO LIKE...
chapter 8 part 2
51 terms
CPS 350 Exam 1 Part 6
51 terms
APCS Ch. 10 Test Review
28 terms
quiz 11
50 terms