Tema86

1

May 8th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. 1.feladat
  2. public class Main{
  3. public static void main (String[] args){
  4. Tabla t=new Tabla ('p','z');
  5. t.kiir();
  6. }
  7. }
  8. public class Tabla{
  9. char [][] tabla;
  10.  
  11. public Tabla (char fekete, char feher){
  12. tabla = new char [8][8];
  13. for(int i=0; i<8;i++){
  14. for(int j=0; j<8;j++){
  15. if((i+j)%2==0){
  16. tabla [i][j]= feher;
  17. }else {
  18. tabla [i][j]= fekete;
  19. }
  20. }
  21. }
  22. }
  23.  
  24. public void kiir(){
  25. for(int i=0; i<8;i++){
  26. for(int j=0;j<8;j++){
  27. System.out.print(tabla [i][j]+ " ");
  28. }
  29. System.out.println();
  30. }
  31. }
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment