MoreOnClasses
This commit is contained in:
@ -1,5 +1,6 @@
|
|||||||
package com.example;
|
package com.example;
|
||||||
|
|
||||||
|
import com.practice.Vehicle; //Import a java file from another java package
|
||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
|
|
||||||
public class Main {
|
public class Main {
|
||||||
@ -84,6 +85,5 @@ public class Main {
|
|||||||
|
|
||||||
double p = Math.pow(2, 3);
|
double p = Math.pow(2, 3);
|
||||||
System.out.println(p);
|
System.out.println(p);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package com.example;
|
package com.practice;
|
||||||
|
|
||||||
public class Animal {
|
public class Animal {
|
||||||
void bark(){
|
void bark(){
|
@ -1,18 +1,19 @@
|
|||||||
package com.example;
|
package com.practice;
|
||||||
|
|
||||||
public class Vehicle {
|
public class Vehicle {
|
||||||
int maxSpeed;
|
static int counter;
|
||||||
int wheels;
|
public int maxSpeed;
|
||||||
String color;
|
public int wheels;
|
||||||
double fuelCapacity;
|
public String color;
|
||||||
Vehicle() {
|
public double fuelCapacity;
|
||||||
|
public Vehicle() {
|
||||||
this.setColor("Red");
|
this.setColor("Red");
|
||||||
}
|
}
|
||||||
Vehicle(String c) {
|
Vehicle(String c) {
|
||||||
this.setColor(c);
|
this.setColor(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
void horn() {
|
public void horn() {
|
||||||
System.out.println("Beep!");
|
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.
16
more_on_classes/pom.xml
Normal file
16
more_on_classes/pom.xml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>com.oop</groupId>
|
||||||
|
<artifactId>more_on_classes</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
</project>
|
7
more_on_classes/src/main/java/com/oop/Main.java
Normal file
7
more_on_classes/src/main/java/com/oop/Main.java
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
package com.oop;
|
||||||
|
|
||||||
|
public class Main {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
System.out.println("Hello world!");
|
||||||
|
}
|
||||||
|
}
|
BIN
more_on_classes/target/classes/com/oop/Main.class
Normal file
BIN
more_on_classes/target/classes/com/oop/Main.class
Normal file
Binary file not shown.
Reference in New Issue
Block a user