MIdterm2

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/26

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

27 Terms

1
New cards

What is a interface?

A collection of constants and abstract methods

2
New cards

What do interfaces not include

No instance data and constructors

3
New cards

How to define a constant

final

4
New cards

In a interface what is the accessibility of data fields and methods

Public static final and public static

5
New cards

If a class implements two classes with the same default method what must happen

the class must override and make their own method implementation

6
New cards

For this declaration:
Measurable obj2 = new Country();

If country has a play anthem function does the call:
obj2.playAnthem();

run?

No

7
New cards

Measurable match = a1.findMatch(a2,a3);
How can you explicit cast this to allow the account function deposit to work?

Account matchAccount = (Account) match;

matchAccount.deposit(100);

8
New cards

When to use comparator vs comparable

Comparable is a predefined sorting preference internal to the class whilst comparator is when you custom define your own sorting order externally.

9
New cards

Whats a Member Inner Class

Class created within the parent class and outside the methods

10
New cards

Whats a Local Inner Class

Class created within a method in a class

11
New cards

Anonymous Inner class

Class created for implementing or extending classes

12
New cards

How to Create an anonymous inner class

Write

13
New cards

Whats a functional interface

A function with only one abstract method

14
New cards

whats the first thing you want to do when creating a javafx class named FirstFX

public class FirstFX extends Application{}

15
New cards

What is the application class in javaFX

contains the init, start, and stop methods

16
New cards

what does the start method look like

public void start(Stage primaryStage){}

17
New cards

what should the main program look like if you want to run the program

public static void main(String[] args){
launch(args)
}

18
New cards

whats the Stage class

Stage is the class that represents a window

19
New cards
public void start(Stage primaryStage){
	//Enter Code Here
}

How do you change the title of this function and show it as correct

primaryStage.setTitle("Correct");
primaryStage.show();

20
New cards

What is the scene in javafx

It is for the content of a stage only one can be displayed at a time

21
New cards

Write full code for a text to appear (50 × 100) “Hello World” within a (400 × 200) frame

public void start(Stage primaryStage){


Text hello = new Text(50, 100, "Hello World");

Pane root = new Pane();
root.getChildren.add(hello);

Scene scene = new Scene(root,400,200);
	primaryStage.setTitle("Correct");
primaryStage.setScene(scene);


primaryStage.show();

22
New cards

Creating Rectangle in javaFX

Rectangle r = new Rectangle(x,y,w,h);

23
New cards

how to change this rectangles colour:

Rectangle r = new Rectangle(x,y,w,h);

r.setFill(Paint p);

24
New cards

How to draw a circle

Ellipse e = new Ellipse(centerx,centery,xradius,yradius);

25
New cards

How to change the outline and width

setStroke(Paint p) and setStrokeWidth(int w)

26
New cards
27
New cards