Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't find system.out.println()

I created a project, it asked me to select JDK version and finish.

I couldn't find system namespace in autocomplete.

I typed it manually but IDEA told me that system doesn't exist.

like image 238
JatSing Avatar asked Dec 13 '11 16:12

JatSing


People also ask

Where does system out Println go?

println does not print to the console, it prints to the standard output stream ( System. out is Java's name of the standard output stream). The standard output stream is usually the console, but it doesn't have to be. The Java runtime just wraps the standard output stream of the operating system in a nice Java object.

How do I run system out Println?

The println() method is similar to print() method except that it moves the cursor to the next line after printing the result. It is used when you want the result in two separate lines. It is called with "out" object. If we want the result in two separate lines, then we should use the println() method.

What library is Println in Java?

println() is used to print an argument that is passed to it. The statement can be broken into 3 parts which can be understood separately as: System: It is a final class defined in the java. lang package.

Why system out Println should not be used?

System. out. println is an IO-operation and therefor is time consuming. The Problem with using it in your code is, that your program will wait until the println has finished.


3 Answers

It's System (with a cap)

Some very useful shortcuts:

soutm (+TAB) ==> System.out.println("Class.And.Method.Name") soutv (+TAB) ==> System.out.println("Last variable used = " + value); sout (+TAB) ==> System.out.println(); 

I really love IntelliJ. Glad I moved to it from Eclipse a couple of years ago ;)

like image 159
Guillaume Avatar answered Sep 24 '22 13:09

Guillaume


Just type sout.

public class Main {

public static void main(String[] args) {
    int data = 1;
    System.out.println(); ===>sout 
    System.out.println("Main.main"); ===>soutm 
    System.out.println("args = [" + args + "]"); ===>soutp 
    System.out.println("data = " + data); ===>soutv 
}

}

sout - just print System.out.println()

soutm - added Class name & method name

soutp - added parameter

soutv - added last variable name

like image 40
Damith Ganegoda Avatar answered Sep 23 '22 13:09

Damith Ganegoda


We can change the auto complete settings to to ignore case. Go to:

File -> Settings... -> IDE Settings -> Editor -> Code Completion 

and change 'Case sensitive completion' to 'None'.

like image 37
Shivaprasad Avatar answered Sep 23 '22 13:09

Shivaprasad