Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Car {
- public String name;
- public String model;
- public double price;
- public Car () {
- }
- public Car (String m,Double pr) {
- this.model=m;
- this.price=pr;
- }
- public void display() {
- System.out.println("name is :"+name);
- System.out.println("model is :"+model);
- System.out.println("price is :"+price);
- }
- public static void main(String args[]) {
- Car c1=new Car("blue",100.0);
- System.out.println("this is second object");
- c1.display();
- }}
Advertisement
Add Comment
Please, Sign In to add comment