Blog Introductions
In this blog contains tutorials about HTML Tutorials, Python Tutorials, CSS Tutorials, How to, PHP Tutorials, Java Tutorials, C++ Tutorials, Tutorials, Examples, Source code,Learning,
Tips and Software development services. Java Functions and Passing parameter | Java tutorials Bestitworriors
Tips and Software development services. Java Functions and Passing parameter | Java tutorials Bestitworriors
Java Functions and Passing parameter
Java Functions and Passing parameter | Java tutorials Bestitworriors - Function are the block of code that execute when it called.You can also pass one or more then one parameters to the function.Function perform various function .Function write once and can be use multipule time in the code.Function declare with return type and function name and then brackets.We can make static function in java.
Some Key Points of Java Functions
- A block of code that execute when it is called
- Function write once and can be used or called multiple time
- You can pass one or more parameters to the function
- Function can return the result or value
- Functon can be static function
- Function can't run without calling it
Code
public
class Functionss {
static void myMethod() {
System.out.println("Best it worrior is best platform");
}
static void myMethod(String fname) {
System.out.println(fname + " Member");
}
static int plusMethodInt(int x, int y) {
return x + y;
}
public
static
void
main(String[]
args) {
myMethod();
myMethod("adil");
myMethod("akil");
myMethod("ameer");
int
myNum1 = plusMethodInt(8, 5);
System.out.println(myNum1);
}
}
OutPut
Best it worrior is best platform
adil Member
akil Member
ameer Member
13
adil Member
akil Member
ameer Member
13
0 Comments