package Java2; import java.awt.*; import java.awt.event.*; public class Demo1 {           public static void Array(String[] args) {            // string array for x    String[] x = {"x x"," x x "," x "," x x ","x x"};       // string array for y    String[] y = {"y y"," y y "," y "," y "," y "};       // string array for z    String[] z = {"zzzzz"," z "," z ","z ","zzzzz"};              }    public static void main(String[] args) {           char input;    int i;    for (i = 0; i < x.length; ++i) {        printx=x[i] ;        printy=y[i] ;        printy=z[i] ;        input='xz';    if (input.char(0)='x'&&input.char(1)='z;') {        System.out.println(printx + " " + " "+ printz);    }    else if if (input.char(0)='y'&&input.char(1)='x;') {        System.out.println(printy + " " + " "+ printx);    }    else if if (input.char(0)='z'&&input.char(1)='y;') {        System.out.println(printz + " " + " "+ printy);    }    }    } }

Fundamentals of Information Systems
8th Edition
ISBN:9781305082168
Author:Ralph Stair, George Reynolds
Publisher:Ralph Stair, George Reynolds
Chapter7: Knowledge Management And Specialized Information Systems
Section: Chapter Questions
Problem 20SAT
icon
Related questions
Question

Please help me fix my Java Array Method. Need to have an output like this:

 

 

 

 

Please explain what I'm missing on my code:

package Java2;

import java.awt.*;
import java.awt.event.*;


public class Demo1 {
  
       public static void Array(String[] args) {
           // string array for x
   String[] x = {"x x"," x x "," x "," x x ","x x"};
  
   // string array for y
   String[] y = {"y y"," y y "," y "," y "," y "};
  
   // string array for z
   String[] z = {"zzzzz"," z "," z ","z ","zzzzz"};
     
       }

   public static void main(String[] args) {
  
       char input;
   int i;
   for (i = 0; i < x.length; ++i) {
       printx=x[i] ;
       printy=y[i] ;
       printy=z[i] ;
       input='xz';
   if (input.char(0)='x'&&input.char(1)='z;') {
       System.out.println(printx + " " + " "+ printz);
   }
   else if if (input.char(0)='y'&&input.char(1)='x;') {
       System.out.println(printy + " " + " "+ printx);
   }
   else if if (input.char(0)='z'&&input.char(1)='y;') {
       System.out.println(printz + " " + " "+ printy);
   }
   }
   }

X
X
Zzzzz
Z
X X
X
X X
X X ZZZZZ
Z
Z
Transcribed Image Text:X X Zzzzz Z X X X X X X X ZZZZZ Z Z
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Arrays
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Fundamentals of Information Systems
Fundamentals of Information Systems
Computer Science
ISBN:
9781305082168
Author:
Ralph Stair, George Reynolds
Publisher:
Cengage Learning