Saludos el error esta en la siguiente instrucion
Games ob1 = new Games();
ob1 g;
aqui les dejo programa completo ;(
package samplegames;
class Ps4{
String console;
int category;
Ps4(String console,int category)
{
this.console=console;
this.category=category;
}
}
class Games{
String G[]={"Sport","RPG","Shooters","Clasics"};
int choice[]={0,1,2,3};
Ps4 getGames(int i){
if(i>=0 & i<G.length)
return new Ps4(G[1],choice);
else
return new Ps4("Ivalid",0);
}
}
public class SampleGames {
public static void main(String[] args) {
Games ob1 = new Games();
ob1 g;
g = ob1.getGames(1);
System.out.println(g.console + " your choice " +g.choice);
g = ob1.getGames(2);
System.out.println(g.console + " your choice: " +g.choice);
}
}
Games ob1 = new Games();
ob1 g;
aqui les dejo programa completo ;(
package samplegames;
class Ps4{
String console;
int category;
Ps4(String console,int category)
{
this.console=console;
this.category=category;
}
}
class Games{
String G[]={"Sport","RPG","Shooters","Clasics"};
int choice[]={0,1,2,3};
Ps4 getGames(int i){
if(i>=0 & i<G.length)
return new Ps4(G[1],choice);
else
return new Ps4("Ivalid",0);
}
}
public class SampleGames {
public static void main(String[] args) {
Games ob1 = new Games();
ob1 g;
g = ob1.getGames(1);
System.out.println(g.console + " your choice " +g.choice);
g = ob1.getGames(2);
System.out.println(g.console + " your choice: " +g.choice);
}
}