+ 3

What is class in java give real time example?

meaning

5th Jul 2018, 1:47 AM
Nithish Kumar B
Nithish Kumar B - avatar
1 Respuesta
+ 1
A class in Java is like a recipe for baking cookies. It defines what ingredients (attributes) are needed, along with the steps (methods) to follow. Just as the recipe can be used to create multiple batches of cookies, a class can be used to create multiple objects with shared characteristics and behaviors. Real-time example⤵️ Let's consider a class named "Car" in Java. This class could have attributes like "brand", "model", "color", etc., and methods like "start()", "stop()", "accelerate()", etc. Objects created from this class would represent individual cars with their specific attributes and behaviors.
12th Apr 2024, 8:02 PM
`ᴴᵗᵗየ
`ᴴᵗᵗየ - avatar