any other way to print the text without using
System.out.println() in java?

Answer Posted / srinivas

Using PrintWriter class-

PrintWriter writer = new PrintWriter(System.out);
writer.println("Method 2");



PrintWriter makes the output internationalizable - because encodings like UTF-8 can be specified.

Is This Answer Correct ?    0 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How many inner classes can a class have?

814


What is basic syntax?

756


What is the difference between && and & in java?

819


What is the concept of multithreading?

736


what is session in java?

991


What is void data type?

759


Can we declare a constructor as final?

920


What is the difference between serial and throughput garbage collector?

798


What is the relationship difference the canvas class and the graphics class?

808


How do you include a string in java?

758


What are the advantages of packages in java?

925


Can we create a class inside a class in java?

753


How do you check if two strings are equal in java?

807


What is passed by reference and pass by value ?

776


What environment variables are required to be set on a machine in order to run Java programs?

881