CoreJavaQus Set1
CoreJavaQus Set1
In any Java program, the main() method is the starting point from where
compiler starts executing the code. So, the compiler needs to call the main()
method.
If the main() is allowed to be non-static, then while calling the main() method
JVM has to instantiate its class.
While instantiating it has to call the constructor of that class, There will be
ambiguity if the constructor of that class takes an argument.
Static method of a class can be called by using the class name only without
creating an object of a class.
1
https://www.linkedin.com/in/gayatri-mishra-freelancecoach/
Question -2 : What are the new features added in Java 8 w.r.t Interface ?
2
https://www.linkedin.com/in/gayatri-mishra-freelancecoach/
3
https://www.linkedin.com/in/gayatri-mishra-freelancecoach/
Question -4: Can we convert different primitive data type values to String in
Java ?
What is valueof method ?
Yes we can convert any primitive data type values to String using
String.valueof()
valueOf() :
valueof() method is used to convert any primitive data types values to
string.
By using valueof method we can convert the int , long , char , double ,
boolean to String
Syntax :
String val = String.valueof(var)