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.
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