Category: JAVA Programs

JAVA Program to Display Student Result using Interface 0

JAVA Program to Display Student Result using Interface

Follow me JAVA Program to Display Student Result using Interface: interface calculateResult { public void calculate_total(); public void calculate_percentage(); public void calculate_grade(); } class student implements calculateResult { int no,m1,m2,m3 ; String name; int...

JAVA Program to Calculate Number of Vowel in String 0

JAVA Program to Calculate Number of Vowel in String

Follow me JAVA Program to Calculate Number of Vowel in String: import java.io.*; import java.lang.*; class vowel { public static void main(String args[]) { String s=”This is string”; int cnt=0; for(int i=0;i<s.length();i++) { if(s.charAt(i)==’a’||s.charAt(i)==’e’||s.charAt(i)==’i’||s.charAt(i)==’o’||s.charAt(i)==’u’||...

JAVA Program to Find Area of Rectangle 0

JAVA Program to Find Area of Rectangle

Follow me JAVA Program to Find Area of Rectangle: class rect { int len,wid; int area; rect(int l,int w) { len=l; wid=w; } void area() { System.out.println(“Area of Rectangle is:”+(len*wid)); } public static void...

JAVA Program to Print Odd Numbers up to 100 0

JAVA Program to Print Odd Numbers up to 100

Follow me JAVA Program to Print Odd Numbers up to 100: import java.io.*; class even { public static void main(String args[]) { int n=100; System.out.println(“Odd Numbers are:”); for(int i=1;i<=n;i++) { if(i%2!=0) System.out.println(i); } }...

JAVA Program to Print Even Numbers up to 100 0

JAVA Program to Print Even Numbers up to 100

Follow me JAVA Program to Print Even Numbers up to 100: import java.io.*; class even { public static void main(String args[]) { int n=100; System.out.println(“Even Numbers are:”); for(int i=1;i<=n;i++) { if((i%2)==0) System.out.println(i); } }...

JAVA Program to Copy File Byte by Byte 0

JAVA Program to Copy File Byte by Byte

Follow me JAVA Program to Copy File Byte by Byte: import java.io.*; class cpyfile { public static void main(String args[])throws IOException { int i; FileInputStream f1; FileOutputStream f2; try { f1=new FileInputStream(args[0]); //Command Line...

JAVA Program to Accept Value from Command Line 0

JAVA Program to Accept Value from Command Line

Follow me 88 Barontuts   JAVA Program to Accept Value from Command Line: import java.io.*; class cmd { public static void main(String args[]) { String a=args[0]; int b=Integer.parseInt(args[1]); System.out.println(b); System.out.println(a); } } OUTPUT: 88...

JAVA Program to Accept Value using Buffered Reader 0

JAVA Program to Accept Value using Buffered Reader

Follow me JAVA Program to Accept Value using Buffered Reader: import java.io.*; class buffrdredr { public static void main(String args[]) throws IOException { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); System.out.println(“Enter any String “); String a=br.readLine(); System.out.println(“Enter...

JAVA Program to Find Sum of Digit of Number 0

JAVA Program to Find Sum of Digit of Number

Follow me JAVA Program to Find Sum of Digit of Number: import java.io.*; class sod { public static void main(String args[]) { String a=”1234″; int sum=0,rem=0,len; len=a.length(); int no=Integer.parseInt(a); for(int i=1;i<=len;i++) { rem=no%10; sum=sum+rem;...