DEV Community

yaswanth krishna
yaswanth krishna

Posted on

Object Class and Method Creation

`package basic_start;

public class teaching {
    public static void main(String[] args) {
        teaching teach = new teaching();
        teach.tech();//{
        teach.trainner();//    method calling statements }
        teach.math(10,2);
    }// complete them main method

    public void tech() {             // its method callfare
        System.out.println("teaching");
    }
    public void trainner() {
        System.out.println("trainner");
    }
    public void math(int no1,int no2) {    // if use calling method 10,2 
                                           // you write a method  inside a
                                           // (int no1,int no2)you will add callfore
        System.out.println(no1+no2);
    }

}
`
Enter fullscreen mode Exit fullscreen mode

Top comments (0)