Question

Java! How do I make the array {"O", "D"}, {"L", "L"}, {"L", "R"}, {"E", "O"}, {"H",...

Java! How do I make the array {"O", "D"}, {"L", "L"}, {"L", "R"}, {"E", "O"}, {"H", "W"} appear as "Hello World" .

0 0
Add a comment Improve this question Transcribed image text
Answer #1
public class PrintArray {

    public static void main(String[] args) {
        String[][] data = {{"O", "D"}, {"L", "L"}, {"L", "R"}, {"E", "O"}, {"H", "W"}};

        for (int i = 0; i < data[0].length; i++) {
            for (int j = data.length - 1; j >= 0; j--) {
                System.out.print(data[j][i]);
            }
            System.out.print(" ");
        }
        System.out.println();
    }
}


Add a comment
Know the answer?
Add Answer to:
Java! How do I make the array {"O", "D"}, {"L", "L"}, {"L", "R"}, {"E", "O"}, {"H",...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • I have a 2D character array like this: [ [1 D E F G H]   [2...

    I have a 2D character array like this: [ [1 D E F G H]   [2 C E] [3 A C] [4 H I J]   [5 A B D]] How do you make a character array consisting of distinct alphabets? That is the output should be [A B C D E F G H I J]. I need a C++ code for the same.

  • Do anyone knows how to write this in java?    You are allowed to use the...

    Do anyone knows how to write this in java?    You are allowed to use the following methods from the Java API: class String length charAt class StringBuilder length charAt append toString class Character any method moveXDownLeft takes a char and a two dimensional array of char as input and returns nothing: The method should find the first occurrence of the char in the array (searching from "top" to "bottom" and "left" to "right"), and it should slide that character...

  • Write a Java method that searches a 2-d array for a specific character. Return the index...

    Write a Java method that searches a 2-d array for a specific character. Return the index of the first location of the character. Method header: public static void play(char c, char[][]wordSearch){ Example: a e v s l g r e d k h k q s e z j c p o a t s o v a n m n l q p f o x b The character 's' appears at index 0,3.

  • Use your I n y o u r own w o r d s, e x...

    Use your I n y o u r own w o r d s, e x p l a i n p er i o d i c m o t i o n, a n d g i v e e x a m p l e s. In your own words, explain energy in simple harmonic motion. Describe stress, strain, and elastic deformation, and give examples.

  • Please write this in java Write one static method to print each character in the output....

    Please write this in java Write one static method to print each character in the output. There should be methods to print: H, E, L, O, (comma), W, R, D and (exclamation point). The method to print H should be called printH() and the method to print the comma should be called printComma(). Make sure to separate characters with a new line in the method (except the comma) as shown on right. Write a method called printHelloWorld() to call the...

  • utilizing r, how do you do this function? Make a 2 dimensional array of normally distributed...

    utilizing r, how do you do this function? Make a 2 dimensional array of normally distributed random numbers in R with 20 rows and 2 columns Use array(x , dim = c(20, 2)), make sure that the vector, x, has the correct number of observations to match the dimensionality, namely 40 (20 x 2)

  • why is this wrong for vectors vector<char> decrypt{ {'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',...

    why is this wrong for vectors vector<char> decrypt{ {'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A'}, {'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B'}, }; for(int...

  • Calculat??e ?E?o for the half-cell OH?- l? H?2? I Pt at 25 degrees celsius by using...

    Calculat??e ?E?o for the half-cell OH?- l? H?2? I Pt at 25 degrees celsius by using the value for the ion product of water K ?w = 1.0*1014 ?, and remember that the half-cell H ?+ ?I H 2 I Pt is the reference electrode for measuring all standard half-cell potentials. (Hints: Start by calculating ?G?o? for the dissociation reaction of water. The half-cell reactions that are involed are H ?+ + e?--- > (1/2)H ?2 and ?H ?2O? +...

  • Java In your own custom ArrayList<E> class(do not use Java Array List API) use Array algorithm...

    Java In your own custom ArrayList<E> class(do not use Java Array List API) use Array algorithm Write a static function called RemoveNullElements() without creating another array. that remove Null elements and shift all the rest of the elements to the left/front (small indexes) of the array without changing the size or length of the original array( this meant the front of the array will have all the not Null elements, and the other haft will be empty/Null. Please provide test...

  • You are to write two functions, printString() and testString(), which are called from the main function....

    You are to write two functions, printString() and testString(), which are called from the main function. printString (string) prints characters to std::cout with a space after every character and a newline at the end. testString (string) returns true if the string contains two consecutive characters that are the same, false otherwise. See the main() to see how the two functions are called. Some sample runs are given below: string: “hello” printString prints: h e l l o testString returns: true...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT