Browsing Category

Java

What is Java?

Java is a computer programming language. It enables programmers to write computer instructions using English based commands, instead of having to write in numeric codes. It’s known as a “high-level” language because it can be read and…

Java – Reverse String without using Reverse function

package JavaPrograms; import java.util.*; public class ReverseString { public static void main(String args) { String original, reverse =""; Scanner in = new Scanner(System.in); System.out.println("Enter a string to reverse"); original =…

Java – Remove Duplicate Number from Array

package JavaPrograms; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; public class RemoveduplicateArray { // // Remove duplicate entries from an array of long…

Java – Program to Find Prime Number

package JavaPrograms; import java.util.*; public class PrimeNumber { //Note: Scanner class work with JDK1.5 or above public static void main(String args) { int n, i, res; boolean flag=true; System.out.println("Please Enter a No."); Scanner…

Java – Program Palindrome Series

package JavaPrograms; import java.util.*; public class palindrome { public static void main(String args) { String original, reverse=""; Scanner in = new Scanner(System.in); System.out.println("Enter a string to check if it is a…

Java – Program Intersection of Two Arrays

package JavaPrograms; import java.util.HashSet; import java.util.Set; public class IntersectionofArrays { public static void main(String args) { int firstInts = new int{2,3,4,5,5,7,9,0,0,0}; int secondInts = new int{2,44,2,33,8,5,12,14,0};…

Java – Program Integer Array Sorting

package JavaPrograms; import java.util.Arrays; public class IntArraySorting { public static void main(String args) { int arrayList = {1,2,4,5,9,3,6,22,33}; int len = arrayList.length; Arrays.sort(arrayList); for(int i=0;i<len; i++) {…

Java – Compare Two Array Program

package JavaPrograms; public class CompareArray { public static void compareArrays(int array1, int array2) { boolean b = true; if (array1 != null && array2 != null){ if (array1.length != array2.length) b = false; else for (int i =…

Java – BubbleSort Program

package JavaPrograms; import java.util.Scanner; class BubbleSort { public static void main(String args) { int n, c, d, swap; Scanner in = new Scanner(System.in); System.out.println("Input number of integers to sort"); n = in.nextInt(); int…