Articles on Trending Technologies

Technical articles with clear explanations and examples

How to redirect URLs with your Hosting Account?

Fendadis John
Fendadis John
Updated on 25-Feb-2020 327 Views

You can easily redirect URLs to the settings under your hosting account. Let’s say you have a blogger blog and you want to redirect it to your website.A redirect automatically sends your visitors to another destination, within the same site or a new URL.Follow the below given steps to redirect URLs to your hosting account, Go to your hosting account and log in.Click Manage Web Hosting and reach the cPanel. Here, search the Domains section and click Redirects, Now, a section can be seen to add a redirect. Here, fill the following fields to redirect URL, TypeThe type of redirect ...

Read More

Initialization, declaration and assignment terms in Java

Arushi
Arushi
Updated on 25-Feb-2020 3K+ Views

A variable provides us with named storage that our programs can manipulate. Each variable in Java has a specific type, which determines the size and layout of the variable's memory; the range of values that can be stored within that memory; and the set of operations that can be applied to the variable.You must declare all variables before they can be used. Following is the basic form of a variable declaration − data type variable [ = value][, variable [ = value] ...] ;Here data type is one of Java's datatypes and variable is the name of the variable. To ...

Read More

Best book to learn Java programming for beginners

Daniol Thomas
Daniol Thomas
Updated on 25-Feb-2020 393 Views

Following books are on top from popularity and content wise and are a good resource to learn java programming from beginner to advance level.

Read More

Method overloading with autoboxing and widening in Java.

Arjun Thakur
Arjun Thakur
Updated on 25-Feb-2020 370 Views

Widening refers to passing a lower size data type like int to a higher size data type like long. Method overloading is possible in such case. Example public class Tester {     public static void main(String args[]) {         Tester tester = new Tester();         short c = 1, d = 2;         int e = 1, f = 2;         System.out.println(tester.add(c, d));         System.out.println(tester.add(e, f));     }     public int add(short a, short b) {         System.out.println("short");         return a + b;     }     public int add(int a, int b) {         System.out.println("int");         return a + b;     } } Output Short 3 Int 3

Read More

Which is the best book for Java interview preparation

Krantik Chavan
Krantik Chavan
Updated on 25-Feb-2020 250 Views

Following books are on top from popularity and content wise and are a good resource to learn java programming from beginner to advance level.

Read More

Pass by reference vs Pass by Value in java

Giri Raju
Giri Raju
Updated on 25-Feb-2020 8K+ Views

Call by Value means calling a method with a parameter as value. Through this, the argument value is passed to the parameter. While Call by Reference means calling a method with a parameter as a reference. Through this, the argument reference is passed to the parameter. In call by value, the modification done to the parameter passed does not reflect in the caller's scope while in the call by reference, the modification done to the parameter passed are persistent and changes are reflected in the caller's scope. But Java uses only call by value. It creates a copy of references ...

Read More

Passing array to method in Java

Jai Janardhan
Jai Janardhan
Updated on 25-Feb-2020 504 Views

Just as you can pass primitive type values to methods, you can also pass arrays to methods. For example, the following method displays the elements in an int array -Examplepublic static void printArray(int[] array) {    for (int i = 0; i < array.length; i++) {       System.out.print(array[i] + " ");    } }You can invoke it by passing an array. For example, the following statement invokes the print Array method to display 3, 1, 2, 6, 4, and 2 -printArray(new int[]{3, 1, 2, 6, 4, 2});

Read More

default access modifier in Java

Nancy Den
Nancy Den
Updated on 24-Feb-2020 5K+ Views

Default access modifier means we do not explicitly declare an access modifier for a class, field, method, etc.A variable or method declared without any access control modifier is available to any other class in the same package. The fields in an interface are implicitly public static final and the methods in an interface are by default public.ExampleVariables and methods can be declared without any modifiers, as in the following examples -String version = "1.5.1"; boolean processOrder() {    return true; }

Read More

How can I clear or empty a StringBuilder in Java.

mkotla
mkotla
Updated on 24-Feb-2020 3K+ Views

You can either setLength to be 0 or create a new StringBuilder() instance. See the example below −Examplepublic class Tester { public static void main(String[] args) { StringBuilder builder = new StringBuilder(); builder.append("sample"); System.out.println(builder.toString()); builder.setLength(0); System.out.println(builder.toString()); builder.append("sample"); System.out.println(builder.toString()); } }Outputsample sample

Read More

Breaking out of nested loop in java

usharani
usharani
Updated on 24-Feb-2020 611 Views

Yes, break statement can be used in nested for loops. It works on the for loop in which it is applied. See the example below.Examplepublic class Tester { public static void main(String[] args) { for(int i = 0; i< 2; i++) { for(int j = 0; j < 2; j++){ if(i == 1) { break; } System.out.println("i = " + i+",j = " + j); } } } }

Read More
Showing 54761–54770 of 61,299 articles
Advertisements