answersLogoWhite

0

What is add method in a java program?

Updated: 8/20/2019
User Avatar

Dshivani17

Lvl 1
12y ago

Best Answer

If the "add" is part of the Java Collections API then calling c.add(o) adds an object o to the given collection (list or set). Likewise, the AWT API has add methods to add components to a Frame or Panel.

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is add method in a java program?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Can we add website link when we write java program?

yes ,i can add the website link in java program when we write.


What will happen if a Java Class has no Main Method?

Nothing will happen. There is no restriction that every Java class must have a main method. The only program is that, this class cannot be executed as a standalone java program.


Can you run java program without applying main method?

yes we can run java program without using main. we can run program by declaring the variable static..


Why main is used in java?

In java need main() method. without main() in java we won't run the java programe main() signals the entry point to the program - it tells the Java Virtual Machine which is the first program that should be executed.


How to write java program without using main method?

Java program without mainWe need a main method for executing a program.But YES we can write a program without using main() method.TRICK 1 of 2 :: while writing applets in java we don't use main... we use init() method instead.TRICK 2 of 2 :: using 'static' we can write a program whic will execute successfully and output the desired message on screen. Here it is :: class Mohit{ static { System.out.println("This java program has run without the main method"); System.exit(0); } } -->save the program as Mohit.java to compile::javac Mohit.java (in command prompt) to run ::java Mohit(command prompt) output will be ::This java program has run without the main methodWhoa!!!!! we are done.;)


Which exception is thrown by the add method of Collection interface in java?

exception


Program for length of list in java?

Java's List interface defines the size() method, which can be used to retrieve the length of a list.


The main method of a program has?

The Java main method of a program is the place where the program execution begins. A main method would look like below public static void main(String[] args){ }


What is the task of main method in a java program?

The main method is simply an entry point to your executable code. When you run a Java program, it looks for a main method as the first section of code to execute, which is why all of your programs start there.


Where can someone find information on the Java language for no such method error be found?

"No such method" is an error message that may appear when attempting to create a program with Java. Users who understand the Java programming language can find an answer on websites such as Stack Overflow and Crafting Java.


How do you write a java program to find the square root of a number?

You can use the Math.sqrt() method.


What is task of main method in Java?

All applications must start their execution from somewhere. In java that is the main method of a class.