Posts by Author : tgugnani

Java

Jun 2, 2017

tgugnani

Java language revolves around the Object Oriented Programming (OOP), the base of OOP is Classes and Objects. This post is dedicated to Understanding the need for OOP and about Classes and how that wor...
Read Article

Java

Jun 2, 2017

tgugnani

Java Basics Java Primitive Data Types Operators in Java Control Flow : If:then and If:then:else statements Control Flow: For, while and do while loop in Java Arrays in Java Classes and Met...
Read Article

Java

Jun 1, 2017

tgugnani

1. Using Custom Method First we will write the manual method to compare two Java Arrays for Equality. The logic is pretty simple, first we compare the length of both Arrays in consideration and if...
Read Article

Java

Jun 1, 2017

tgugnani

We have created a sample String array with few String values to check for Duplicate. To Check the Duplicate we need to compare the current String value with rest of the values. The below code approach...
Read Article

Java

Jun 1, 2017

tgugnani

To get the Random int values we utilise the java.util.Math provided under java library. Since Math.random()returns random double value between 0 and 1 , we multiply it by 100 to get random numbers bet...
Read Article

Java

May 29, 2017

tgugnani

1. Using Custom Method   import java.util.Arrays; public class ArrayCopy { public static void main(String args[]) { String[] myStringArray = { "Alice", "Bob", "Tim", "John",...
Read Article

Java

May 29, 2017

tgugnani

public class ArraySecondHighest { public static void main(String args[]) { int[] myIntArray = { 12, 13, 14, 15, 16, 89, 23, 1, 90, 100 }; Arrays.sort(myIntArray); Sys...
Read Article

Java

May 29, 2017

tgugnani

Although there are inbuilt method in the commons.lang library using which we can remove the element in array with just a single statement , we will first approach this using a custom method to see how...
Read Article

Java

May 29, 2017

tgugnani

1. Using Custom Method Following is the Java code to reverse the elements of an array by writing a self custom method. import java.util.Arrays; public class ArrayReverse { public static vo...
Read Article

Java

May 29, 2017

tgugnani

Using custom method Following is the Java code to check if your array contains any specific element. public class ArrayContains { public static void main(String args[]){ i...
Read Article