1/26
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
What is a interface?
A collection of constants and abstract methods
What do interfaces not include
No instance data and constructors
How to define a constant
final
In a interface what is the accessibility of data fields and methods
Public static final and public static
If a class implements two classes with the same default method what must happen
the class must override and make their own method implementation
For this declaration:
Measurable obj2 = new Country();
If country has a play anthem function does the call:
obj2.playAnthem();
run?
No
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);
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.
Whats a Member Inner Class
Class created within the parent class and outside the methods
Whats a Local Inner Class
Class created within a method in a class
Anonymous Inner class
Class created for implementing or extending classes
How to Create an anonymous inner class
Write
Whats a functional interface
A function with only one abstract method
whats the first thing you want to do when creating a javafx class named FirstFX
public class FirstFX extends Application{}
What is the application class in javaFX
contains the init, start, and stop methods
what does the start method look like
public void start(Stage primaryStage){}
what should the main program look like if you want to run the program
public static void main(String[] args){
launch(args)
}
whats the Stage class
Stage is the class that represents a window
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();
What is the scene in javafx
It is for the content of a stage only one can be displayed at a time
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();
Creating Rectangle in javaFX
Rectangle r = new Rectangle(x,y,w,h);
how to change this rectangles colour:
Rectangle r = new Rectangle(x,y,w,h);
r.setFill(Paint p);
How to draw a circle
Ellipse e = new Ellipse(centerx,centery,xradius,yradius);
How to change the outline and width
setStroke(Paint p) and setStrokeWidth(int w)