12:21 am - Monday June 26, 2017

Author Archives: Mathan Lal

Java Example Program to count number of words in a file

/** *@author:candidjava.com *@description:To find number of words in a file */ import java.io.FileReader; import java.io.BufferedReader; import java.util.StringTokenizer; class NumberWords { public static void main(String[] args)...

Java Example Program for Delete vowels in given string

/** *@Author : candidjava.com *@Description : java example program for Delete vowels in given string */ public class Vowels { public static void main(String[] args) { String l = "MANIkandan"; String k = l.replaceAll("[aeiouAEIOU]",...

Java Example Program for Total Area Of Cone

/** @author : candidjava.com @description : program that gives the value for area of cone using math class. */ import java.lang.Math; public class AreaofCone { int r, s; void areacone(int r, int s) { double area; area = (Math.PI)...

Java Example Program for Selection sort

//example program for Selection sort /** *@author:candidjava.com *@description:selectionSort() */ import java.io.*; public class SelectionSort // creation of class { public static void main(String[] args) throws IOException { int a; BufferedReader...

Java Example Program for Delete element from array

/** * @ Auther : Candidjava.com * @ Description : To Delete Element from array. */ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class DeleteElement { static int[] a = { 1,...

Java Example Program for Insert element in array

/** *@Author : Candidjava.com *@Description : java example program for Insert element in array */ public class Array { public static void main(String[] args) { int[] a = new int[7]; a[0] = 3; a[1] = 4; a[2] = 5; a[3] = 6; System.out.print("Before...

Java Example Program for Binary search

/** *@Author : Candidjava.com *@Description : Example for Binary search () */ public class FindnoBinarySearch { public void BinarySearch(int a[], int t) { int low = 1; int high = a.length; // find the length of array and assign into...

Java Example Program for Maximum element in array

/** @author:candidjava.com @description:java example program for Maximum element in array */ public class MaximumOfArray { public static void main(String args[]) { int a[] = { 69, 23, 47, 81, 92, 88, 52, 48, 56, 66, 65, 76, 71, 85,...

Java Example Program for Print pascal triangle

/** *@ Auther : Candidjava.com *@ Description : To Print the PASCAL Triangle */ public class Pascal { int i,j,k,l=1; void PrintPascal(int n) { for (i=1;i<=n;i++) { for(j=1;j<=n-i;j++) { System.out.print(" "); } for(k=0;k<i;k++) { System.out.print(i...

Java Example Program for Factorial

/** program : Factorial of the number. author : "candid" date :27.10.2012 */ class Factorial { public static void main(String[] ar) { int number = 5; int factorial = number; for(int i =(number - 1); i > 1; i--) { factorial...

Java Example Program for Add digits

/** *@Author : Candidjava.com *@Description : java example program for Add digits */ public class Addition { public static void main(String[] args) { int num1 = 10, num2 = 11, num3 = 6, num4 = 5; int total; total = num1 + num2...

Java Example Program using logical AND,logical OR

/** * @ Auther : Candidjava.com @ Descritption : Perform AND & OR Opeations */ public class AndOrOperations { void AndOr() { int a = 10, b = 28, s, t; System.out.println(“a=” + a + “\t b=” + b); s = a & b; //...

Java Example Program for reminder without modulation (%) operator

/** *@auther      : Candidjava.com *@Description : To findout reminder without modulation operator */ public class Modulation { public void Mod() { int dv=27,dr=12,i; System.out.println("Dividend = " + dv); System.out.println("Divisor...

Java Example Program for sum of given number

/** * @Auther : Candidjava.com * @Description : Sum of given numbers */ public class Sum { void SumOfNumbers(int[] a) { int i, s = 0; for (i = 0; i < a.length; i++) // loop upto length of array a { System.out.println("a["...

Java Example Program for perimeter of cone

/** *@author : Candidjava.com *@description : To find perimeter of the cone */ public class Cone { public void Perimeter() { float radius = 2.0f, pi = 3.14f; float surface = (2 * pi * radius), p; System.out.println("Surface...

Java Example Program for perimeter of Scalene Triangle

/** *@Author : Candidjava.com *@Description : java example program for perimeter of Scalene Triangle */ public class Perimeter { public static void main(String[] args) { int a = 10, b = 5, c = 6; // a,b,c's are 3 sides of the triangle int...

Java Example Program for area of Equilateral Triangle

/** * program :TO FIND EQUILATERAL TRIANGLE. author : "candid" date :02.10.2012 */ class Triangle { public static void main(String[] args) { int a = 45; int b = 96; int c = 45; if ((a + b > c) && (b + c >...

Java Example Program for area of right angle triangle

/** * @description: Area of right angled triangle program. * @author: Arun */ import java.util.Scanner; public class R_angle { public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.print("\nEnter...

Java Example Program for area of right angle triangle

/** * @description: Area of right angled triangle program. * @author: Arun */ import java.util.Scanner; public class R_angle { public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.print("\nEnter...

Integer Example Program for string to string()

/** * @author:candidjava.com * @Description: this returns a string object representing the specified *               integer. */ public class Stringtostreg { void strint() { Integer x = 7; System.out.println("with...