Answers for "calling function java"

3

how to call a function in java

public class MyClass {
 
    static void myMethod() {
        System.out.println("You have called me! My name is: myMethod!");
    }
 
    public static void main(String[] args) {
        myMethod();
    }
}
Posted by: Guest on February-24-2021
0

calling function in java using object

import java.util.Scanner;

public class SecondstoHrMinSec 
{
  static void getHours() {
    int p2 = seconds / 60;
  }
    static void getMinutes() {
    int p3 = p2 % 60;
  }
	public static void main(String[] args)
	{
		// create object of scanner class.
		Scanner in = new Scanner(System.in);

		// enter the seconds here.
		System.out.print("Enter seconds : ");

		int seconds = in.nextInt(); 
      	int p1,p2,p3;

		int p1 = seconds % 60;
		getMinutes();
		getHours();

		p2 = p2 / 60;

		System.out.print("HH:MM:SS - " +p2 + ":" + p3 + ":" + p1);
		System.out.print("\n");
	}  
}
Posted by: Guest on July-05-2021
3

how to call a function in java

public class MyClass {
 
    static void myMethod() {
        System.out.println("You have called me! My name is: myMethod!");
    }
 
    public static void main(String[] args) {
        myMethod();
    }
}
Posted by: Guest on February-24-2021
0

calling function in java using object

import java.util.Scanner;

public class SecondstoHrMinSec 
{
  static void getHours() {
    int p2 = seconds / 60;
  }
    static void getMinutes() {
    int p3 = p2 % 60;
  }
	public static void main(String[] args)
	{
		// create object of scanner class.
		Scanner in = new Scanner(System.in);

		// enter the seconds here.
		System.out.print("Enter seconds : ");

		int seconds = in.nextInt(); 
      	int p1,p2,p3;

		int p1 = seconds % 60;
		getMinutes();
		getHours();

		p2 = p2 / 60;

		System.out.print("HH:MM:SS - " +p2 + ":" + p3 + ":" + p1);
		System.out.print("\n");
	}  
}
Posted by: Guest on July-05-2021

Code answers related to "calling function java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language