-
Notifications
You must be signed in to change notification settings - Fork 1
Get cubeArr
Akshath Raghav edited this page Jun 28, 2021
·
1 revision
String[] temp2 = {"RRRR", "GGGG", "OOOO", "BBBB", "WWWW", "YYYY"};
Cubot cube = new Cubot(temp2) ;
String[] cubeInput = cube.cubeToArr() ;
for (String i : cubeInput) {
System.out.print(i + " ");
}
System.out.println();
String[] temp = {"RRRRRRRRR", "GGGGGGGGG", "OOOOOOOOO", "BBBBBBBBB", "WWWWWWWWW", "YYYYYYYYY"};
cube = new Cubot(temp) ;
cubeInput = cube.cubeToArr() ;
for (String i : cubeInput) {
System.out.print(i + " ");
}
Say we want to copy a Cubot to another. Now, we don't have to do the lengthy input process again. Instead, all we have to do is call the cubeToArr() method and directly insert it into the constructor of another Cubot.
String[] temp2 = {"RRRR", "GGGG", "OOOO", "BBBB", "WWWW", "YYYY"};
Cubot cube = new Cubot(temp2) ;
System.out.println();
String[] test = cube.cubeToArr() ;
Cubot cube2 = new Cubot(temp2) ;
System.out.println("cube and cube2 are the same ? -- " + cube.compareTo(cube2)); // -- true
Read on to see Cubot in action