Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Alternate Statements of System.out.println()

Tags:

java

printing

Can anybody please help me by providing different ways of printing other than System.out.println() statement in Java?

like image 798
hari Avatar asked Dec 09 '22 08:12

hari


1 Answers

import org.apache.log4j.Logger;
....
public class example{

static Logger log = Logger.getLogger(this.class);

.....
public void test(){
 String hello ="Hello World";
 log.trace(hello);
}
....
}

output will be :
TRACE:(<classname>){2011-10-38-06:644} Hello World 2011-05-10 08:38:06,644
like image 59
Georgian Citizen Avatar answered Dec 11 '22 21:12

Georgian Citizen