12:18 am - Thursday March 23, 2017

Author Archives: Mathan Lal

Integer Example Program for short shortValue()

/** * @author:Candidjava.com * @description: Program that use shortValue method of Integer class to convert *               into short type. */ public class Integershort { public static void main(String[] args) { Integer...

Java Example Program for find profit

/** * program : TO FIND PROFIT. author : "candid" date : 01.11.2012 */ // code class Profit { int sellingprice; int costprice; int profit; Profit(int s, int c, int p) { sellingprice = s; costprice = c; profit = p; } } public...

Java Example Program for smallest of three number

/** program : smallest three number. author : "candid" date :27.10.2012 */ /Prgram class Small { public static void main( String[] args ) { int a=7; int b=14; int c=34; { if (a<b) { if (a<c){System.out.println("A...

Java Example Program for bigest of given three numbers

/** *@author:candidjava.com *@description:bigest of given three numbers */ import java.io.*; public class BiggestThree // creation of class { public static void main(String[] args) throws IOException { BufferedReader br = new...

Java Example Program for swap number using addition operator

/** * @auther : Candidjava.com * @description : Swapping two numbers using Addition & Subtraction */ public class Swapno { void Swapnumber(int a, int b) { System.out.println("Before Swapping"); System.out.println("a="...

Java Example Program for harmonic series

/** *Author : Candid.java *Description : Program for Harmonic series */ import java.io.*; public class HarmonicSeries { public static void main(String args[]) { int num = Integer.parseInt(args[0]); // convert the input string...

Java Example Program for gemetric series

/** * @author : Arun * @description:Geometric Series program. */ import java.lang.*; public class Geo { int a, r; void Series() { for (int i = 0; i <= 6; i++) // For loop to determine the number of // terms in geometric series { double...

Java Example Program to find volume cone

/** * @Author:Candidjava * @discription:VolumeAreaOfCone.To find the value of volume area of cone **/ public class Sample { int r, h; // To declare the int value of r,h. double Vcone; // declare double value final double pi = 3.14; Sample(int...

Java Example Program to find flat Area cone

/** @author:Candidjava @discription:FlatAreaCone @To find the value of Flatareacone */ import java.lang.Math; //To import the math package public class Sample { int r, R, h; // to declare the int value double SA; // to declare...

Java Example Program to find curved Surface of Area of cone

/** * @author:candid java * @discription:curvedSurfaceofAreaOfCone */ public class Sample { int r, p, SA; // To declare the int value SA,p,r,l int l; Sample(int r, int p, int l) { this.p = p; this.l = l; this.r = r; } void...

Java Example Program to find whether a matrix Zero or null matrix

/** *@author:candidjava.com *@description:Java Example program to find whether a matrix is Zero or NULL matrix */ import java.util.Arrays; public class ZeroMatrix { public static void main(String[] args) { int[] numbers...

Byte Example Program for static Byte valueOf(String s,int radix)

/** * * @author:candidjava.com * @description:java Byte Example program for static Byte valueOf(String s,int * radix) */ public class ByteValueOf { public static void main(String[] args) { String...

Integer Example Program for static Byte decode(String nm)

/** * *@author:candidjava.com *@description:java Byte Example program for static Byte decode(String nm) */ public class ByteDecode { public static void main(String[] args) { Byte b1, b2, b3; // creating 3 Byte objects b1...

Java Integer Example Program for static String toOctalString(int i)

/** * *@author:candidjava.com *@description:java Integer Example program for static string toOctalString(int * i) */ public class StringToOctalString { public static void main(String[] args) { String...

StringBuffer code for append(float f) in java

/** * @ Auther : Candidjava.com @ Description : Example for StringBuffer * append(float f) Method */ public class StringBufferExample5 { public static void main(String args[]) { // StringBuffer append(float f) method appends float...

StringBuffer code for append(double d) in java

/** * @ Auther : Candidjava.com @ Description : Example for StringBuffer * append(double d) Method */ public class StringBufferExample4 { public static void main(String args[]) { // StringBuffer append(double d) method appends double...

StringBuffer code for append(char[]str,int offset,int len) in java

/** * *@author:candidjava.com *@description:StringBuffer code for append(char[] str,int offset,int len)in *                           java */ public class StringBufferAppend { public static void main(String[]...

Thread Example Program for stop(Throwable obj)

/** * *@author:candidjava.com *@description:Thread example program for stop(Throwable obj) */ public class ThreadStop implements Runnable { public void run() { System.out.println("Starting " + Thread.currentThread().getName() +...

Thread Example Program for setUncaughtExceptionHandler(Thread.UncaughtExceptionHandler eh)

/** *@author:candidjava.com *@description:Thread example program for setUncaughtExceptionHandler(Thread setUncaughtExceptionHandler eh) */ public class java { public static void main(String[] args) { Thread trd = new Thread(new...

Thread Example program for join(long mills,int nanos)

** program : Java using join. author : "candid" date :22.11.2012 */ public class Join1 implements Runnable { public void run() { Thread th = Thread.currentThread(); System.out.println(th.getName()+" is alive "+th.isAlive()); } public...