Java - Doubt with imports

0

Good morning.

Why this does not work?

import java.lang.System;
out.println("Hola mundo");

Sorry I can not put the full code, but I'm from the cell.

Thank you very much.

    
asked by FermatsTheorem 23.02.2017 в 17:38
source

1 answer

2

Basically you have to refer to which class the property out belongs to. As much as you care about it, Java does not recognize out , so you'll have to do:

System.out.println("Hola mundo");

If you want to simplify it, you could do something like this:

import java.io.PrintStream;

public class HelloWorld
{
  static PrintStream imprimir = System.out;

  public static void main(String[] args)
  {
    imprimir.print("HOLA");
    imprimir.print(" MUNDO");
  }
}
    
answered by 23.02.2017 / 17:45
source