Professional Documents
Culture Documents
JAVA
PROGRAMMING
EXTERNAL PRACTICAL
BPIBS
Program -1
Output:
NAME : Yatinder Singh Rawat
ROLL NO. - 07211402020
Program -2
}
public void add()
{
int addition = 0;
for(int i = 0;i<arr.length;i++)
{
addition += arr[i];
}
NAME : Yatinder Singh Rawat
ROLL NO. - 07211402020
System.out.println("Addition = "+addition);
}
}
Output:
NAME : Yatinder Singh Rawat
ROLL NO. - 07211402020
Program-3
import java.util.Scanner;
public class ques
{
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int a,b;
int result;
System.out.println("Enter value of a");
a=sc.nextInt();
System.out.println("Enter value of b");
b=sc.nextInt();
try{
result=a/b;
System.out.println("Result ="+result);
}
catch(ArithmeticException e){
e.printStackTrace();
NAME : Yatinder Singh Rawat
ROLL NO. - 07211402020
// System.out.println(e);
System.out.println("Denominator is zero ");
}
sc.close();
}
}
Output:
NAME : Yatinder Singh Rawat
ROLL NO. - 07211402020
Program-4
class AEIOU {
String str = new String("AEIOU");
void replace() {
System.out.print("Blank SpaceAfter Every Character :");
for (int i = 0; i < str.length(); i++) {
System.out.print(str.charAt(i));
System.out.printf(" ");
}
}
NAME : Yatinder Singh Rawat
ROLL NO. - 07211402020
void LowerCase() {
void reverse() {
System.out.println("Reverse :" + str2.reverse());
}
}
public class Ques_20 {
public static void main(String[] args) {
}
}
Output:
Program-5
NAME : Yatinder Singh Rawat
ROLL NO. - 07211402020
Output: