NameSilo

[Resolved] Need help with JAVA code

SpaceshipSpaceship
Watch

zk0

Established Member
Impact
3
Need help with JAVA code

Hey! It's me again :)

I want to create the following pattern:
Code:
* * * * * * * * 
 * * * * * * * * 
* * * * * * * * 
 * * * * * * * * 
* * * * * * * * 
 * * * * * * * * 
* * * * * * * * 
 * * * * * * * *

Using only this line of code:
Code:
System.out.print(" ");
System.out.print("* ");
System.out.println();

So I need some loop codes to make this work. This is the code I got now:
Code:
public class stars {

	public static void main(String[] args)
	{
	        for (int i = 0; i < 4; ++i)
	        {
	        	System.out.print("* ");
	        	System.out.println();
	        
	        for (int k = 0; k < 1; ++k)
		        {
		        	System.out.print(" ");
		        	System.out.print("* ");
		        	System.out.println();
		        }
	        }
}
}

That code makes it look like this:
Code:
* 
 * 
* 
 * 
* 
 * 
* 
 *

What do I miss?
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Answered on webmasters-meet.com .

Nick
 
0
•••
CatchedCatched

We're social

Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
DomainEasy — Payment Flexibility
DomDB
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back