This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a comment |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script id="jsbin-javascript"> | |
var number = 5; | |
var text = '5'; | |
console.log(number); | |
console.log(text); | |
console.log(number == text); | |
console.log(number === text); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class EncapsulationNonExample { | |
// variables | |
public int age; | |
// default constructor | |
public EncapsulationNonExample() { | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class EncapsulationExample { | |
// variables | |
private int age; | |
// default constructor | |
public EncapsulationExample() { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Testing { | |
public static void main(String[] args) { | |
Person steve = new Person(); | |
steve.info(); | |
Person jessica = new Person("Jessica", 23, true); | |
jessica.info(); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Person { | |
// Fields or Instance variables | |
private String name; | |
private int age; | |
private boolean isFemale; | |
// Default contructor | |
public Person () { | |
name = "Steve"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Employee extends Person { | |
// default constructor | |
public Employee() { | |
} | |
// constructor with arguments | |
public Employee(String name, int age, boolean isFemale) { | |
super(name, age, isFemale); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void main(String[] args) { | |
// Variables | |
Scanner in = new Scanner(System.in); | |
int shapeLength; | |
String shape; | |
// Get length and shape from the user | |
System.out.print("Enter the length of the shape: "); | |
shapeLength = in.nextInt(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FXMLDocumentController implements Initializable { | |
// Needs to have @FXML otherwise you'll get errors and your program will not run | |
@FXML private Slider mySlider; | |
@Override | |
public void initialize(URL url, ResourceBundle rb) { | |
// You have three different variables available | |
// I used newValue which is the sliders value after it is moved |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void main(String[] args) { | |
// Variables | |
Scanner in = new Scanner(System.in); | |
int shapeLength; | |
String shape; | |
// Get length and shape from the user | |
System.out.print("Enter the length of the shape: "); | |
shapeLength = in.nextInt(); |
NewerOlder