MoreOnClasses
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
package com.example;
|
||||
|
||||
import com.practice.Vehicle; //Import a java file from another java package
|
||||
import java.util.Scanner;
|
||||
|
||||
public class Main {
|
||||
@ -84,6 +85,5 @@ public class Main {
|
||||
|
||||
double p = Math.pow(2, 3);
|
||||
System.out.println(p);
|
||||
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.example;
|
||||
package com.practice;
|
||||
|
||||
public class Animal {
|
||||
void bark(){
|
@ -1,18 +1,19 @@
|
||||
package com.example;
|
||||
package com.practice;
|
||||
|
||||
public class Vehicle {
|
||||
int maxSpeed;
|
||||
int wheels;
|
||||
String color;
|
||||
double fuelCapacity;
|
||||
Vehicle() {
|
||||
static int counter;
|
||||
public int maxSpeed;
|
||||
public int wheels;
|
||||
public String color;
|
||||
public double fuelCapacity;
|
||||
public Vehicle() {
|
||||
this.setColor("Red");
|
||||
}
|
||||
Vehicle(String c) {
|
||||
this.setColor(c);
|
||||
}
|
||||
|
||||
void horn() {
|
||||
public void horn() {
|
||||
System.out.println("Beep!");
|
||||
}
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
ClassesAndObjects/target/classes/com/practice/Vehicle.class
Normal file
BIN
ClassesAndObjects/target/classes/com/practice/Vehicle.class
Normal file
Binary file not shown.
Reference in New Issue
Block a user