Is main a keyword in Java?

varun
Updated on 30-Jul-2019 22:30:20

766 Views

No, main is not a keyword in Java.

What is the difference between compile time polymorphism and runtime polymorphism in java?

usharani
Updated on 30-Jul-2019 22:30:20

916 Views

If we perform (achieve) method overriding and method overloading using instance methods, it is run time (dynamic) polymorphism. In dynamic polymorphism the binding between the method call an the method body happens at the time of execution and, this binding is known as dynamic binding or late binding. Example Live Demo class SuperClass{ public static void sample(){ System.out.println("Method of the super class"); } } public class RuntimePolymorphism extends SuperClass { public static void sample(){ System.out.println("Method of the ... Read More

Is null a keyword in Java?

usharani
Updated on 30-Jul-2019 22:30:20

438 Views

No, null is not a keyword. Though they seem like keywords null, true and, false are considered as literals in Java.

What is Is-a relationship in Java?

varma
Updated on 30-Jul-2019 22:30:20

947 Views

IS-A is a way of saying: This object is a type of that object. Let us see how the extends keyword is used to achieve inheritance.Examplepublic class Animal { } public class Mammal extends Animal { } public class Reptile extends Animal { } public class Dog extends Mammal { }Now, based on the above example, in Object-Oriented terms, the following are true −Animal is the superclass of Mammal class.Animal is the superclass of Reptile class.Mammal and Reptile are subclasses of Animal class.Dog is the subclass of both Mammal and Animal classes.Example Live Democlass Animal { } class Mammal extends Animal ... Read More

How to return an array from a method in Java?

Lakshmi Srinivas
Updated on 30-Jul-2019 22:30:20

5K+ Views

We can return an array in Java from a method in Java. Here we have a method createArray() from which we create an array dynamically by taking values from the user and return the created array.Example Live Demoimport java.util.Arrays; import java.util.Scanner; public class ReturningAnArray {    public int[] createArray() {       Scanner sc = new Scanner(System.in);       System.out.println("Enter the size of the array that is to be created:: ");       int size = sc.nextInt();       int[] myArray = new int[size];       System.out.println("Enter the elements of the array ::");       for(int i=0; i

What does the method clone() do in java?

Ankitha Reddy
Updated on 30-Jul-2019 22:30:20

117 Views

The clone() method of the java.util.ArrayList class returns a shallow copy of this ArrayList instance(i.e. the elements themselves are not copied). Example import java.util.ArrayList; public class ArrayListDemo { public static void main(String args[]) { ArrayList arrlist1 = new ArrayList(); arrlist1.add(new StringBuilder("Learning-")); ArrayList arrlist2 = (ArrayList) arrlist1.clone(); StringBuilder strbuilder = arrlist1.get(0); strbuilder.append("list1, list2-both pointing to the same StringBuilder"); ... Read More

What is core JavaScript language?

Giri Raju
Updated on 30-Jul-2019 22:30:20

2K+ Views

Core JavaScript is the basis of the JavaScript language. JavaScript is a dynamic computer programming language. It is lightweight and most commonly used as apart from web pages, whose implementations allow a client-side script to interact with the user and make dynamic pages.The JavaScript language has the following components: Core JavaScript:Core JavaScript is the basic of the JavaScript language supports both the client and server side.Client-side javascript (CSJS)The client-side JavaScript has core JavaScript elements.  For functioning, it also has properties and methods, which helps developers.Server-side JavaScript (SSJS) Server-side JavaScript, as the name suggests runs on server-side. The core is part of client-side ... Read More

How to add items to an array in java dynamically?

Ankitha Reddy
Updated on 30-Jul-2019 22:30:20

9K+ Views

Since the size of an array is fixed you cannot add elements to it dynamically. But, if you still want to do it then, Convert the array to ArrayList object.Add the required element to the array list.Convert the Array list to array.Exampleimport java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; public class AddingItemsDynamically {    public static void main(String args[]) {       Scanner sc = new Scanner(System.in);       System.out.println("Enter the size of the array :: ");       int size = sc.nextInt();       String myArray[] = new String[size];       System.out.println("Enter elements of the array ... Read More

How to create a generic array in java?

Abhinanda Shri
Updated on 30-Jul-2019 22:30:20

168 Views

No, we can’t create generic arrays in java.

Apply filtering on Model to fetch filtered data in ABAP

Prabhas
Updated on 30-Jul-2019 22:30:20

80 Views

I think a simple change can sort the problem out over here. Just replace the read call with an object notation rather than the current one which is based on position.

Advertisements