I have to create a reference like example 1 x 5 (one row and 5 columns) having the symbol *. so my output should look like *****. Im new to java and also would like to know a good book to practice the language.Can someone tell me how to obtain the output?
            Asked
            
        
        
            Active
            
        
            Viewed 131 times
        
    -4
            
            
        - 
                    6What have you tried doing? Also asking for book recommendations is off-topic – UnholySheep Mar 19 '17 at 10:49
- 
                    Use `print` instead of `println`. – luk2302 Mar 19 '17 at 10:51
3 Answers
0
            
            
        Read some java basics, here are some personal recommendations,
- Thinking in Java, by Bruce Eckel
- Head First with Java
- Java for Dummies
- Effective Java by Joshua Bloch
and ofcourse,
you can always refer to Java documentations, https://docs.oracle.com/javase/8/docs/
If someone have some more options, please feel free to edit the post.
 
    
    
        drink-a-Beer
        
- 389
- 1
- 5
- 14
0
            
            
           public class PrintSymbol
    {
        public static void main(String[] args)
        {
            //++row or prefix increment because of better loop performance
            //print * while row <=5
            for(int row=1;row<=5;++row)
            {
                System.out.print("*");
            }
        }
}
about the book that you are saying please buy a book entitled "Java Programming" by Joyce Farrell, she is a great university teacher and her book is on point for the beginner
 
    
    
        0xDEADBEEF
        
- 590
- 1
- 5
- 16
-3
            
            
        you can use very code
for example
for(byte row = 1 ; row <= 5 ; row++)
   System.out.println("*");
or
for(byte row = 1 ; row <= 5 ; row++)
    System.out.print("*\n");
 
    
    
        MohammadReza Ghafarpour
        
- 59
- 2
- 12
- 
                    2And yet you managed to provide a wrong answer, which doesn't respect Java naming conventions, and is not idiomatic at all. – JB Nizet Mar 19 '17 at 10:57
- 
                    The edit is still wrong. And if you feel the need to add *"your Questions is so easy!!!"* then you probably shouldn't be writing an answer at all. Basic questions like these should be closed and OP redirected to proper tutorials – UnholySheep Mar 19 '17 at 11:01
- 
                    
- 
                    Execute it, and you'll see that it doesn't generate one row and 5 columns, but 1 column and 5 rows. – JB Nizet Mar 19 '17 at 11:18
