Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

simple function java


public class Sample {
    public static void main(String[] args) {
        add(6,4);
    }

    static void add(int num1, int num2) {
        System.out.println(num1 + num2);
    }

}
Comment

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"
    }
}
Comment

PREVIOUS NEXT
Code Example
Java :: java variables 
Java :: Maven Dependency for flyway 
Java :: how to take float input in java 
Java :: java using .indexof to fin a space 
Java :: how to clear text fields in java 
Java :: java substring after character 
Java :: calling activity method from fragment: 
Java :: how to find prime numbers in java 
Java :: inheritance in oop 
Java :: java exception list 
Java :: set solid color background android programatically in drawable 
Java :: java print stack 
Java :: gat environment variables java 
Java :: how to make priority queue of pairs in java 
Java :: android java get value from listview item 
Java :: spring security auto login after register 
Java :: Java printf() Method using PrintWriter 
Java :: cors spring 
Java :: number to char java 
Java :: java add element to existing array 
Java :: Android: remove shadow from bottom navigation 
Java :: Program to remove duplicates in an ArrayList 
Java :: java iterator index 
Java :: java check string contains uppercase character 
Java :: enum values to string array 
Java :: reverse java 
Java :: java concatenate strings 
Java :: flutterwave BVN api 
Java :: array find max in java 
Java :: Java Access ArrayList Elements 
ADD CONTENT
Topic
Content
Source link
Name
6+3 =