Answers for "function in java"

3

how to create a function in java

package com.company;

public class Main {
    static void one(){ // youCanPutWhatEverNameYouLikeInThePlaceOf"One"
        System.out.println("HELLO");
    }
    public static void main(String[] args) {
        one(); //theTerminalShouldSay"HELLO"
    }
}
Posted by: Guest on June-05-2021
2

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
1

function in java

public class Main
{
    static void function(){
        System.out.println("I am a function!");
    }
	public static void main(String[] args) {
		function();
	}
}
Posted by: Guest on March-30-2020
5

java how to define a function

//declare a function like this:
void function(int parameter1)
{
	//function body
}
//call the function like this:
function(1);
Posted by: Guest on December-19-2019
1

declare function in java

static void myMethod() {
    //LINES OF CODE
  }
Posted by: Guest on January-21-2021
0

what is a method example in java

public int addNum(int num1, int num2) {
  total = num1 + num2;
  System.out.println("Total: " + total);
}
Posted by: Guest on February-20-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language