calling function in java using object

Solutions on MaxInterview for calling function in java using object by the best coders in the world

showing results for - "calling function in java using object"
Mads
29 Jul 2016
1import java.util.Scanner;
2
3public class SecondstoHrMinSec 
4{
5  static void getHours() {
6    int p2 = seconds / 60;
7  }
8    static void getMinutes() {
9    int p3 = p2 % 60;
10  }
11	public static void main(String[] args)
12	{
13		// create object of scanner class.
14		Scanner in = new Scanner(System.in);
15
16		// enter the seconds here.
17		System.out.print("Enter seconds : ");
18
19		int seconds = in.nextInt(); 
20      	int p1,p2,p3;
21
22		int p1 = seconds % 60;
23		getMinutes();
24		getHours();
25
26		p2 = p2 / 60;
27
28		System.out.print("HH:MM:SS - " +p2 + ":" + p3 + ":" + p1);
29		System.out.print("\n");
30	}  
31}
32