How to print sideways in Java . | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How to print sideways in Java .

I am trying to write a program sideways like this. 1111 2222. So please help me with the need..

5th Jun 2020, 6:45 AM
Aryan Goel
Aryan Goel - avatar
12 Answers
+ 3
there are printf() or String.repeat(), System.out.println (i+""+""+i+""+""+i+""+""+j) ; System.out.println (i+" "+i+" "+i+" "+j) ; //better System.out.println (i+"\t"+i+"\t"+i+"\t"+j) ; // or \t is for tabulator
5th Jun 2020, 7:16 AM
zemiak
5th Jun 2020, 8:26 AM
Aryan Goel
Aryan Goel - avatar
+ 1
use " quotation mark instead of ' apostrophe
5th Jun 2020, 9:29 AM
zemiak
+ 1
I got how to write sideways
5th Jun 2020, 9:32 AM
Aryan Goel
Aryan Goel - avatar
+ 1
Aryan Goel yes u can write . U tried whole program and u asking what is \t first learn basics.
5th Jun 2020, 11:17 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
0
Can u give the way to write that way
5th Jun 2020, 6:46 AM
Aryan Goel
Aryan Goel - avatar
0
public class Program { public static void main(String[] args) { int i=1; int j=2; System.out.println (i+""+""+i+""+""+i+""+""+j) ; } } //*This is my program*//
5th Jun 2020, 6:57 AM
Aryan Goel
Aryan Goel - avatar
0
Use \t for doing it. What do u mean by this.?
5th Jun 2020, 7:00 AM
Aryan Goel
Aryan Goel - avatar
0
Can u apply it in a program
5th Jun 2020, 7:00 AM
Aryan Goel
Aryan Goel - avatar
0
Thank you zemiak for your help but it is showing some errors can you help to get my way out. public class Program { public static void main(String[] args) { int i=1; int j=2; } System.out.println(i+'\t'+i+'\t'+i+'\t'+j); }
5th Jun 2020, 7:30 AM
Aryan Goel
Aryan Goel - avatar
0
It The last statement instead of writing System.out.println We can write System.out.print
5th Jun 2020, 9:33 AM
Aryan Goel
Aryan Goel - avatar
0
Thanks alotDeek
5th Jun 2020, 3:27 PM
Aryan Goel
Aryan Goel - avatar