2.1k views
3 votes
Write a complete Java program called Stewie2 that prints the following output. Use at least one static method besides main. ////////////////////// || Victory is mine! || \\\\\\\\\\\\\\\\\\\\\\ || Victory is mine! || \\\\\\\\\\\\\\\\\\\\\\ || Victory is mine! || \\\\\\\\\\\\\\\\\\\\\\ || Victory is mine! || \\\\\\\\\\\\\\\\\\\\\\ || Victory is mine! ||

User LFLFM
by
5.2k points

2 Answers

3 votes

//////////////////////

|| Victory is mine! ||

//////////////////////

|| Victory is mine! ||

//////////////////////

|| Victory is mine! ||

//////////////////////

|| Victory is mine! ||

//////////////////////

|| Victory is mine! ||

User Unicorn
by
4.5k points
5 votes

Answer:

// here is code in java.

import java.util.*;

// class definition

class Solution

{

// main method of the class

public static void main (String[] args) throws java.lang.Exception

{

try{

// declare and initialize string pattern

String patt1="//////////////////////";

// declare and initialize string pattern

String patt2="|| Victory is mine! ||";

// both patterns are printed alternatively

for(int x=0;x<10;x++)

{

// first print pattern 1

if(x%2==0)

System.out.println(patt1);

// then print second pattern

else

System.out.println(patt2);

}

}catch(Exception ex){

return;}

}

}

Step-by-step explanation:

Declare and initialize two strings patterns.As there are first pattern on every even line and second pattern on odd line. Run the loop for 10 time and print the pattern based on the position of lines.

Output:

//////////////////////

|| Victory is mine! ||

//////////////////////

|| Victory is mine! ||

//////////////////////

|| Victory is mine! ||

//////////////////////

|| Victory is mine! ||

//////////////////////

|| Victory is mine! ||

User Tyrel Richey
by
5.0k points