#java #javatutorial #javacourse
public class Main {
public static void main(String[] args) {
// Object = An entity that holds data (attributes)
// and can perform actions (methods)
// It is a reference data type
Car car = new Car();
System.out.println(car.make);
System.out.println(car.model);
System.out.println(car.year);
System.out.println(car.price);
System.out.println(car.isRunning);
car.drive();
car.brake();
}
}
public class Car {
String make = "Ford";
String model = "Mustang";
int year = 2025;
double price = 58000.99;
boolean isRunning = false;
void start(){
isRunning = true;
System.out.println("You start the engine");
}
void stop(){
isRunning = false;
System.out.println("You stop the engine");
}
void drive(){
System.out.println("You drive the " + model);
}
void brake(){
System.out.println("You brake the " + model);
}
}
On this page of the site you can watch the video online Learn Java Object Oriented Programming in 10 minutes! 🧱 with a duration of hours minute second in good quality, which was uploaded by the user Bro Code 05 December 2024, share the link with friends and acquaintances, this video has already been watched 80,073 times on youtube and it was liked by 2 thousand viewers. Enjoy your viewing!