Is Java Pass by Reference or Pass by Value?

varun
Updated on 24-Feb-2020 12:22:39

961 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 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 call by reference, the 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 and pass them as ... Read More

Clear or Empty a StringBuilder in Java

mkotla
Updated on 24-Feb-2020 12:21:39

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

Breaking Out of Nested Loop in Java

usharani
Updated on 24-Feb-2020 12:17:34

462 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);          }       }    } }

Get Rows and Columns of 2D Array in Java

varun
Updated on 24-Feb-2020 12:16:59

10K+ Views

Following example helps to determine the rows and columns of a two-dimensional array with the use of arrayname.length.ExampleFollowing example helps to determine the upper bound of a two dimensional array with the use of arrayname.length. public class Main {    public static void main(String args[]) {       String[][] data = new String[2][5];       System.out.println("Dimension 1: " + data.length);       System.out.println("Dimension 2: " + data[0].length);    } }OutputThe above code sample will produce the following result. Dimension 1: 2 Dimension 2: 5

Convert Comma Separated Java String to Array

Prabhas
Updated on 24-Feb-2020 12:15:58

6K+ Views

Yes, use String.split() method to do it. See the example below −Examplepublic class Tester {    public static void main(String[] args) {       String text = "This,is,a,comma,seperated,string.";       String[] array = text.split(",");       for(String value:array) {          System.out.print(value + " ");       }    } }OutputThis is a comma seperated string.

Difference Between Cyber Security and Information Security

Mahesh Parahar
Updated on 24-Feb-2020 12:06:11

1K+ Views

Cyber Security and Information Security both terms are synonymous with each other the difference between the two comes when nature of data which is going to secure. In nutshell Cyber security deals with protecting networks, computers, and data from unauthorized electronic access while Information security deals with protecting information assets regardless of whether the information is in physical or digital format.Data security is all about securing data. But there is difference between data and information. Not every data can be information. Data can be called as information when it is interpreted in a context and given meaning. For example, “14041989″ ... Read More

Difference Between Cost Variance and Schedule Variance

Mahesh Parahar
Updated on 24-Feb-2020 12:04:38

568 Views

For any application or specifically for any project the one of the most concern factors are its budget management and time management in both pre development and post development phase. So to evaluate these both prime factors of any project there are many ways among which Cost Variance and Schedule Variance are the two important and main ways.As name suggests Cost Variance is based on cost that has been spent in development of the project while Schedule Variance is based on time that has been spent in same development. So this is the main difference or characteristics about both variances ... Read More

Difference Between Cost Performance Index (CPI) and Schedule Performance Index (SPI)

Mahesh Parahar
Updated on 24-Feb-2020 12:03:12

737 Views

For any application or specifically for any project the most concern factor is its performance in both pre development and post development phase. So to evaluate the performance of any project there are many ways among which Cost Performance Index (CPI) and Schedule Performance Index (SPI) are the two important and main ways.As name suggests Cost Performance index is based on cost that has been spent in development of the project while Schedule Performance Index is based on time that has been spent in same development. So this is the main difference or characteristics about both indexes however more to ... Read More

Difference Between Abstract Class and Interface in C#

Mahesh Parahar
Updated on 24-Feb-2020 11:51:10

3K+ Views

As we all know that C# is an object oriented programming just like Java and provides full support for object-oriented concepts that are Encapsulation, Abstraction, Inheritance, and Polymorphism. In contrast to Abstraction both Abstract class and Interface are coming out in picture as both of these provides abstraction in C# program.In an abstract class, we can create the functionality and that needs to be implemented by the derived class. The interface allows us to define the functionality or functions but cannot implement that. The derived class extend the interface and implement those functions.Following are the important differences between Abstract Class ... Read More

Differences Between Interface and Integration Testing

Mahesh Parahar
Updated on 24-Feb-2020 11:32:56

2K+ Views

As we know that testing is the most important stage in the process of delivery of any application or software as it is only testing which not only validate the quality of an application but also provides an opportunity to the developer to improve its product.Every application is being developed by comprising development of its constituents different components. Now as we know that Integration testing is the testing in which all components are tested in an integrated environment i.e testing is done collectively of all components with their individual functionalities working altogether.Along with this as we know that all these ... Read More

Advertisements