Ask coding questions

← Back to all posts
Is there a shortcut I can use for system.out.println(); in java?
AshishKaripalli (1)

I dont' want to type out system.out.println(); every time I need to use it.

Comments
hotnewtop
RYANTADIPARTHI (6047)

i guess you could make a function called p or print, and in that function, put system.out.println();. When you want to print, use print.

IntellectualGuy (854)

Hello, you could make a method and use it whenever you want to print it like so

public static void print(String text) {
    System.out.println();
}

or there is

public static void print(String text) {
   // Notice that in the first method it's println and in this one it's print
   System.out.print();
}

If you wanted to do print instead of println.

Repl.it doesn't have this feature but if you use eclipse java (Details on how to download that here), then type sysout and then ctrl + space.

programmeruser (615)
void print(String data) {
  System.out.println(data);
}
EpicGamer007 (1755)

@programmeruser even better:

public static void println(String data) {
  System.out.println(data);
}

public static void print(String data) {
  System.out.print(data);
}
TsunamiOrSumth (539)

make a function called print and make it just do that?