Why cant we define System.out.println() inside a class
directly?

Answers were Sorted based on User's Feedback



Why cant we define System.out.println() inside a class directly?..

Answer / madhu

We can't because The method signature matters when you are
declaring the method. we can't give a name with
System.out.println, but we can define println()

Is This Answer Correct ?    4 Yes 3 No

Why cant we define System.out.println() inside a class directly?..

Answer / madhu

we can override only class methods and we can't override the
output Stream methods.

Is This Answer Correct ?    2 Yes 2 No

Why cant we define System.out.println() inside a class directly?..

Answer / shahid

because println method is not abstract method it is method
of output stream class so we cant override.and it is just
overloded method.

Is This Answer Correct ?    3 Yes 3 No

Why cant we define System.out.println() inside a class directly?..

Answer / venkatachalapathy

we Directly write this line i.e System.out.println()
directly inside a class because println method is static
method in output stream class which are sub classes of
system class.
so every time this method is overridden in our program....
so static methods doesnt require a creation of object.....

Is This Answer Correct ?    3 Yes 3 No

Why cant we define System.out.println() inside a class directly?..

Answer / chandan

because a class is a logical structure and its definition is
group of entities but when we need some functionality we
need to define inside the function

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More Core Java Interview Questions

What is data string?

0 Answers  


Can we have multiple classes in single file ?

0 Answers  


What is the covariant return type?

0 Answers  


What is google full form?

0 Answers  


Why is serialization required?

0 Answers  






What is lambda expression in java?

0 Answers  


Does A Class Inherit The Constructors Of Its Superclass?

0 Answers   Wipro,


How to find the size of an array a)array.length() b)array.length c)array.size() d)array.size

6 Answers   Accenture,


How does arraylist work in java?

0 Answers  


What is instance example?

0 Answers  


What happens to the Exception object after handling an exception?

0 Answers  


Can you override static method in java?

1 Answers  


Categories