Skip to content
Sign upLog in
← Back to Community

Multiple Classes

Profile icon
BloodyCrown

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.

Voters
Profile icon
MuhammadTalha36
Profile icon
Nika101
Profile icon
BloodyCrown