Search This Blog

Wednesday, December 29, 2010

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");
    }
}

1 comment:

  1. Nicely use of coding in Java programming. This is one of the best work of blogger but useful for those who are at learning stage. I am very impressed to his work.

    ReplyDelete