CLASE PRINCIPAL
package javaapplication20;
public class JavaApplication20 {
public static void main(String[] args) {
Saco misaco=new Saco();
int [] vec=new int[3];
for(int i=0;i<3;i++){
vec[i]=2;
}
int []vec1= misaco.barco(vec);
for(int i=0;i<3;i++){
System.out.print(vec1[i]);
}
}
}
CLASE SECUNDARIA
public class Saco {
public int [] barco(int[]a){
int []v=new int[3];
for(int i=0;i<3;i++){
v[i]=a[i];
}
if(1==v[0]){
System.out.print("hola");
}
if(2==v[1]){
System.out.print("holaaaaa");
}
return v;
}
}
package javaapplication20;
public class JavaApplication20 {
public static void main(String[] args) {
Saco misaco=new Saco();
int [] vec=new int[3];
for(int i=0;i<3;i++){
vec[i]=2;
}
int []vec1= misaco.barco(vec);
for(int i=0;i<3;i++){
System.out.print(vec1[i]);
}
}
}
CLASE SECUNDARIA
public class Saco {
public int [] barco(int[]a){
int []v=new int[3];
for(int i=0;i<3;i++){
v[i]=a[i];
}
if(1==v[0]){
System.out.print("hola");
}
if(2==v[1]){
System.out.print("holaaaaa");
}
return v;
}
}
No hay comentarios:
Publicar un comentario