What does the method pop() do in java?

George John
Published on 05-Jan-2018 11:37:46
The pop() method is used to remove the object at the top of this stack and returns that object as the value of this function. Example import java.util.*; public class StackDemo { public static void main(String args[]) { Stack ... Read More

What does the method peek() do in java?

Rishi Raj
Published on 05-Jan-2018 11:40:59
The peek() method is used to look at the object at the top of this stack without removing it from the stack.Exampleimport java.util.*; public class StackDemo {    public static void main(String args[]) {             Stack st = new Stack();       st.push("Java");   ... Read More

What does the method empty() do in java?

Vikyath Ram
Published on 05-Jan-2018 11:45:15
The empty() method is used to test if this stack is or not.Exampleimport java.util.*; public class StackDemo {    public static void main(String args[]) {           Stack st = new Stack();       st.push("Java");       st.push("Source");       st.push("code");       ... Read More

What does the method search(Object o) do in java?

Paul Richard
Published on 05-Jan-2018 11:47:14
The search(Object o) method is used to return the 1-based position where an object is on this stack.Exampleimport java.util.*; public class StackDemo {    public static void main(String args[])  {             Stack st = new Stack();       st.push("Java");       st.push("Source");   ... Read More

What is list interface in Java?

Nikitha N
Published on 05-Jan-2018 14:32:04
The List interface extends Collection and declares the behavior of a collection that stores a sequence of elements.Elements can be inserted or accessed by their position in the list, using a zero-based index.A list may contain duplicate elements.In addition to the methods defined by Collection, List defines some of its own, ... Read More

What are Java container objects like Vector and ArrayList?

V Jyothi
Published on 05-Jan-2018 14:38:17
Java provided ad hoc classes such as Dictionary, Vector, Stack, and Properties to store and manipulate groups of objects. Although these classes were quite useful, they lacked a central, unifying theme. Thus, the way that you used Vector was different from the way that you used Properties.The collections framework was ... Read More

What is the difference between Vector and ArrayList in Java?

Govinda Sai
Published on 05-Jan-2018 14:48:40
ArrayList An array list is created with an initial size. When this size is exceeded, the collection is automatically enlarged. When objects are removed, the array may be shrunk.VectorVector implements a dynamic array. It is similar to ArrayList, but with two differences −Vector is synchronized.The vector contains many legacy methods that ... Read More

How do I empty an array in JavaScript?

Ranjit Kumar
Published on 05-Jan-2018 15:01:58
To empty an array in JavaScript, set the variable to empty:arr = []ExampleYou can try to run the following code to empty an array in JavaScript:<html>    <head>       <title>JavaScript Arrays</title>    </head>    <body>       <script>          var arr = ["orange", "mango", ... Read More

How to use ‘while loop’ in Java?

Johar Ali
Published on 05-Jan-2018 15:13:36
A while loop statement in Java programming language repeatedly executes a target statement as long as a given condition is true.SyntaxThe syntax of a while loop is −while(Boolean_expression) {    // Statements }Here, statement(s) may be a single statement or a block of statements. The condition may be any expression, and ... Read More

What are the class implementations of List interface in Java?

Ramu Prasad
Published on 05-Jan-2018 15:19:41
The List interface extends Collection and declares the behavior of a collection that stores a sequence of elements.Elements can be inserted or accessed by their position in the list, using a zero-based index.A list may contain duplicate elements.In addition to the methods defined by Collection, List defines some of its ... Read More
Advertisements