Créer un objet en Java
className object = new className();
// for Bicycle class
Bicycle sportsBicycle = new Bicycle();
Bicycle touringBicycle = new Bicycle();
SAMER SAEID
className object = new className();
// for Bicycle class
Bicycle sportsBicycle = new Bicycle();
Bicycle touringBicycle = new Bicycle();
class Name{
private String attributes; //as many attributes as you want
Name(){ //no-arg constructor
//TO-DO stuff
}
public String getAttribute(){
return attribute;
}
//in another class
public class Main{
public static void main(String[] args){
Name name = new Name(); //create object of type Name
System.out.println(name.getAttribute()); //prints attribute
}
}