What do u mean by method and also contructer in java ?
Answer Posted / hira ratan sharma
Java methods are similar to functions or procedures in other
programming languages.
Every Java program must have one main() method.
Here is the main() method from a Java program which prints
"Hello World":
public static void main (String[] args) {
// This Java program prints "Hello World!"
System.out.println{"Hello World!");
A constructor creates an Object of the class that it is in
by initializing all the instance variables and creating a
place in memory to hold the Object. It is always used with
the keyword new and then the Class name. For instance, new
String(); constructs a new String object.
COnstructors are basically used to initialize the attributes
of the class.
| Is This Answer Correct ? | 6 Yes | 0 No |
Post New Answer View All Answers
os is developed in c no java is more secured then c na why dont the os developed is developed using java
What is private static class in java?
What is the implementation of destroy method in java. Is it native or java code?
Why hashcode is used in java?
What is a final class ?
What is difference between fail-fast and fail-safe?
How to change value in arraylist java?
What is the current version of java?
What is not object oriented programming?
Define how does a try statement determine which catch clause should be used to handle an exception?
Write a program to find maximum and minimum number in array?
Do you know how to reverse string in java?
Do we need to manually write Copy Constructor?
What is unicode in java?
What are wrapper classes in java?