Ask coding questions

← Back to all posts
Multiple Classes
BloodyCrown (0)

I wonder about can we use multiple classes that are in the same package?
For example(Java);
class Car{
private int maxVelocity=220;
Car(int maxVelocity){
this.maxVelocity=maxVelocity
}
public int getmaxVelocity(){
return maxVelocity;
}
}
public class Main {

public static void main(String[] args) {
Car c= new Car(220);
    System.out.println(c.getmaxVelocity())
}

}
This are diffirent files but in the same package.