remove duplicate code
This commit is contained in:
5
java/Instances.md
Normal file
5
java/Instances.md
Normal file
@ -0,0 +1,5 @@
|
||||
# Java Example
|
||||
|
||||
Relevant Files:
|
||||
|
||||
- [main.java](./classes/main.java)
|
@ -1,18 +0,0 @@
|
||||
/*
|
||||
|
||||
Basic Car class
|
||||
just here to make the demonstration in the main file possible
|
||||
explanation of the code here will be given in later lessons
|
||||
|
||||
*/
|
||||
|
||||
public class Car {
|
||||
public String model = "";
|
||||
public String manufacturer = "";
|
||||
|
||||
public void print_info() {
|
||||
System.out.println("Car Information:");
|
||||
System.out.println("- manufacturer: " + this.manufacturer);
|
||||
System.out.println("- model: " + this.model);
|
||||
}
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
# Java Example
|
||||
|
||||
Relevant Files:
|
||||
|
||||
- [main.java](./main.java)
|
@ -1,18 +0,0 @@
|
||||
public class main {
|
||||
public static void main(String[] args) {
|
||||
// create a new car and store it in the variable 'a'
|
||||
Car a = new Car();
|
||||
// set some data for that car
|
||||
a.manufacturer = "Benz";
|
||||
a.model = "Velo";
|
||||
|
||||
// do the same for a second car
|
||||
Car b = new Car();
|
||||
b.manufacturer = "Ford";
|
||||
b.model = "Model T";
|
||||
|
||||
// use a function of the car class to print out the information
|
||||
a.print_info();
|
||||
b.print_info();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user