class Fruit
{
public static void main(String args[])
{
function nameFruit()
{
System.out.println("Orange");
}
}
}
Fruit f = new Fruit(); //make object of fruit
f.nameFruit();
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
}
}