Category: Java Simple Programs

JAVA Program to Perform String Manipulation Functions 0

JAVA Program to Perform String Manipulation Functions

Follow me JAVA Program to Perform String Manipulation Functions: class StringManipulation { public static void main(String args[]) { StringBuffer str = new StringBuffer(“Object language”); System.out.println(“Original String : “+ str); System.out.println(“Length of string ” +...

JAVA Program for using Wrapper Classes in JAVA 0

JAVA Program for using Wrapper Classes in JAVA

Follow me JAVA Program for using Wrapper Classes in JAVA: // use of wrapper class method import java.io.*; class wraperclass { public static void main(String args[]) { int roll=0; Float marks = new Float(0);...

JAVA Program to Sort Array in Ascending Order 0

JAVA Program to Sort Array in Ascending Order

Follow me JAVA Program to Sort Array in Ascending Order: class NumerSorting { public static void main(String args[]) { int number[] = {55,40,80,65,71}; int n = number.length; System.out.print(“Given list : “); for(int i =0;...

JAVA Program to Sort Array in Descending Order 0

JAVA Program to Sort Array in Descending Order

Follow me JAVA Program to Sort Array in Descending Order: class NumerSorting { public static void main(String args[]) { int number[] = {55,40,80,65,71}; int n = number.length; System.out.print(“Given list : “); for(int i =0;...

JAVA Program to Perform Multiplication of Matrix 0

JAVA Program to Perform Multiplication of Matrix

Follow me JAVA Program to Perform Multiplication of Matrix: class Twodimult { public static void main(String args[]) { int [][] A = {{1,2,3},{4,5,6},{7,8,9}}; int [][] B = {{1,2,3},{4,5,6},{7,8,9}}; int C[][] = new int[3][3] ;...

JAVA Program to Perform Addition of Matrix 0

JAVA Program to Perform Addition of Matrix

Follow me JAVA Program to Perform Addition of Matrix: class Twodimadd { public static void main(String args[]) { int [][] A = {{1,2,3},{4,5,6},{7,8,9}}; int [][] B = {{1,2,3},{4,5,6},{7,8,9}}; //int [][] B = {1,2,3,4,5,6,7,8,9}; int...

JAVA Program to Check Number is Prime or Not 0

JAVA Program to Check Number is Prime or Not

Follow me JAVA Program to Check Number is Prime or Not: class prime { public static void main(String args[]) { int i,m=0,flag=0; int n=13; //This number will be checked m=n/2; for(i=2;i<=m;i++) { if(n%i==0) {...

JAVA Program to Find Factorial of Number 0

JAVA Program to Find Factorial of Number

Follow me JAVA Program to Find Factorial of Number: class fact { public static void main(String a[]) { int n; int fact=1; n=Integer.parseInt(a[0]); System.out.println(“Given Number is : “+n); int no=n; while(n>0) { fact=fact*n; n–;...

JAVA Program to Check Number is Even or Odd 0

JAVA Program to Check Number is Even or Odd

Follow me JAVA Program to Check Number is Even or Odd: import java.io.*; class EvenOdd { public static void main(String arg[]) { int n=Integer.parseInt(arg[0]); System.out.println(“Entered Number is “+n); if (n%2==0) System.out.println(n+ ” is even”);...

JAVA Program to Display Student Details with Marks 0

JAVA Program to Display Student Details with Marks

Follow me JAVA Program to Display Student Details with Marks: class student { int roll; String name; String cl; student(int rn,String n,String c) { roll=rn; name=n; cl=c; } void display() { System.out.println(“Roll No. :...