class Fruit { public static void main(String args[]) { function nameFruit() { System.out.println("Orange"); } } } Fruit f = new Fruit(); //make object of fruit f.nameFruit();