How can I make this pattern in Java?
import java.util.*;
public class Main
{
public static void main(String[] args) {
int i, j;
for(i=1; i<=5; i++) // itereates over row
{
for(j=1; j<=6; j++) // itereates over columns
{
if(j==i || (j==5 - i + 1))
{
if(i == 3)
System.out.print("1111");
else if(j >= 3)
System.out.print(" 11");
else
System.out.print("11");
}
else
{
System.out.print(" ");
}
}
System.out.println();
}
}
}
OUTPUT :
How can I make this pattern in Java? 11 11 11 11 1111 11 11 11 11 Thanks for your help
How can i code this with in java? - $ java Graph 1 2 3 ( 1 2 3 - Java Graph 11 46 37 牛排 # # # | # # # # # # # # # # # # # # # # # # # | 11 46 37 Note: Spaces should be included to the end of each row.
Develop a complete java program that produces a square pattern of asterisks and spaces. First prompt the user for the size of the pattern, then use for loops to print out the pattern. If the user enters a value that is not a number your program's behavior is arbitrary. For non-positive values your program should print nothing and end normally. Your program should work for input values up to the width of the terminal window. Examples for the first 6...
need help with this physics question Discuss how an N-slit pattern can be turned into a good spectrometer. Make sure to write a , sufficiently detailed essay that addresses the issue of the resolvability of wavelengths as well as the type of light source producing these wavelengths, and the size and geometry of the slit pattern. 3. Discuss how an N-slit pattern can be turned into a good spectrometer. Make sure to write a , sufficiently detailed essay that addresses...
i need to make a java program to play Yahtzee. it needs to use arrays. can you help me?
How do i make a recursive binary search that compares two String arrays in java?
How can i make the java class seperate into an MVC pattern? public class ChatView implements ActionListener { public static void main(String[] args) { JFrame chatFrame = new JFrame(); JFrame chatFrame1 = new JFrame(); JFrame chatFrame2 = new JFrame(); JPanel chatPanel = new JPanel(); JPanel chatPanel1 = new JPanel(); JPanel chatPanel2 = new JPanel(); chatFrame.setContentPane(chatPanel); chatFrame1.setContentPane(chatPanel1); chatFrame2.setContentPane(chatPanel2); chatFrame.setLayout(new FlowLayout()); chatFrame1.setLayout(new FlowLayout()); chatFrame2.setLayout(new FlowLayout()); JTextField chatWrite = new JTextField(); JTextField chatWrite1 = new JTextField(); JTextField chatWrite2 = new JTextField(); JTextArea chatDisplay...
PLEASE READ THE FULL INSTRUCTION. Write a Java programme to print the pattern of asterisks shown below. For i=1 For i=2 * * For i=3 For i=n ** * ** ** ......... * (n asterisks) Your program should prompt the user to enter the value of n and then draw the corresponding star pattern. Remember if n is 5, you will have to print five patterns for i=1, i=2, i=3, i=4, and i=5. If n is 3, you will have...
In Android Studio, how can I make a shape change color based on information read from a database? (Java and xml code would be most helpful)
How do you implement a stack using a singly linked list in Java? Can you make it a simple implementation with just push and pop methods.