WHAT'S NEW?
Loading...

FUNCTIONS BASED PROGRAM

class a
{
    public static void main(String args[])
    {
        five ob1=new five();   //syntax: class_name objectname= new classname();
        five ob2= new five();
       
        ob1.func(100);
        ob2.func(300);
    }
}
class five
{
    void func(int mins)
    {
        int hours=mins/60;
        int minutes=mins%60;
       
        System.out.println("The time in hours and minutes is = " +hours + " hours and " +minutes + " minutes");
    }
}

0 comments:

Post a Comment