int myGold = 7; System.out.println(countGold(myGold, 6)); } } class Hobbit { public int countGold(int x, int y) {return x + y }; }
package frodo; /***** give the package name*******/
public class Main extends Hobbit { /****class main extendsanother class called H obbit****/
public static void main(String[] args) {
// TODO code application logic here Hobbit LEKE = new Hobbit(); //initialise what u want class Hobbit to be, here it is Hobbit leke int myGold = 7; // declare MyGold as integer System.out.println(LEKE.countGold(myGold, 6)); // printout ur output as le ke.countgold