public class Demo23{
public static void main(String args[]){
fun() ;
fun() ;
fun() ;
}
public static void fun(){
System.out.println("hello world!!!") ;
}
}; |
public class Demo23{
public static void main(String args[]){
int x = add(10,20) ;
System.out.println(x) ;
}
public static int add(int i,int j){
int t = i + j ;
return t ;
}
}; |
public class Demo24{
public static void main(String args[]){
float x = add(
System.out.println(x) ;
}
public static int add(int i,int j){
int t = i + j ;
System.out.println("两个整数相加。") ;
return t ;
}
public static float add(float i,float j){
float x = i + j ;
System.out.println("两个小数相加。") ;
return x ;
}
}; |
public class Demo25{
public static void main(String args[]){
float x = add(10,20) ;
System.out.println(x) ;
}
public static int add(int i,int j){
int t = i + j ;
System.out.println("两个整数相加。") ;
return t ;
}
public static float add(int j,int k){
float x = k + j ;
System.out.println("两个小数相加。") ;
return x ;
}
}; |
public class Demo26{
public static void main(String args[]){
int x[] = {1,2,43,45,5,6,76,78,8,89,9} ;
print(x) ;
}
public static void print(int temp[]){
for(int i=0;i<temp.length;i++){
System.out.println(temp[i]) ;
}
}
}; |
public class Demo26{
public static void main(String args[]){
int x[] = init() ;
print(x) ;
}
public static void print(int temp[]){
for(int i=0;i<temp.length;i++){
System.out.println(temp[i]) ;
}
}
public static int[] init(){
int y[] = {1,2,43,45,5,6,76,78,8,89,9} ;
return y ;
}
}; |