Posts

Showing posts from July, 2025

BASIC STRING AND ARRAY QUESTION IN JAVA.

 BASIC STRING AND ARRAY QUESTION IN JAVA. 1. Write a java program to reverse a string.  2. Write a java program  to Check if String is Palindrome. 3. Write a java program  to  Count Vowels in a String. 4. Write a java program  to  Check whether two given strings are anagram of each other or not. 5. Write a Java program to find the frequency (count the occurrence) of each element in an integer array. 6. Write a Java program to sum the elements of an array. 7. Write a Java Program to print the elements of an array present on even position. 8. Write a Java Program to find largest element of an array. 9. Write a Java program to find smallest number in an array. 10. Write a Java Program to display Fibonacci series using loops 11. Write a Java Program to find Factorial using loops

BASIC STRING PROGRAMS IN JAVA

 BASIC STRING PROGRAMS IN JAVA 1. Find Length of a String public class StringLength { public static void main (String[] args) { String str = "Hello, Java!" ; System.out.println( "Length of the string: " + str.length()); } } 2. Compare Two Strings public class StringCompare { public static void main (String[] args) { String s1 = "Hello" ; String s2 = "hello" ; System.out.println( "Using equals(): " + s1.equals(s2)); System.out.println( "Using equalsIgnoreCase(): " + s1.equalsIgnoreCase(s2)); } } 3. Concatenate Two Strings j public class StringConcat { public static void main (String[] args) { String s1 = "Hello" ; String s2 = "World" ; String result = s1 + " " + s2; System.out.println( "Concatenated String: " + result); } } 4. Rever...

JAVA PROGRAMS USING OPERATORS

Image
✅ 1. Java Arithmetic Operators Arithmetic operators are used to perform arithmetic operations on variables and data. class Main {   public static void main(String[] args) {     // declare variables     int a = 12, b = 5;     // addition operator     System.out.println("a + b = " + (a + b));     // subtraction operator     System.out.println("a - b = " + (a - b));     // multiplication operator     System.out.println("a * b = " + (a * b));     // division operator     System.out.println("a / b = " + (a / b));     // modulo operator     System.out.println("a % b = " + (a % b));   } } 2. Java Assignment Operators Assignment operators are used in Java to assign values to variables class Main {   public static void main(String[] args) {     // create variables     int a = 4;     int var;     // assign value using = ...

BASIC JAVA PROGRAMS

 BASIC JAVA PROGRAMS ✅ 1.  Check if a Number is Even or Odd Problem : Read a number and check whether it is even or odd. import java.util.Scanner; public class EvenOddCheck { public static void main (String[] args) { Scanner sc = new Scanner (System.in); System.out.print( "Enter a number: " ); int num = sc.nextInt(); if (num % 2 == 0 ) System.out.println(num + " is Even." ); else System.out.println(num + " is Odd." ); } } ✅ 2.  Find the Largest of Three Numbers Problem : Take three numbers as input and find the largest among them. import java.util.Scanner; public class LargestOfThree { public static void main (String[] args) { Scanner sc = new Scanner (System.in); System.out.print( "Enter three numbers: " ); int a = sc.nextInt(); int b = sc.nextInt(); int c = sc.nextInt(); if (a ...

PBCST304 OBJECT ORIENTED PROGRAMMING(2024 SCHEME)

Image
PBCST304 OBJECT ORIENTED PROGRAMMING (2024 SCHEME) 🌈 SYLLABUS 🕮TEXTBOOK  Introduction to Java Programming, Comprehensive Version Y Daniel Liang Pearson 10/e, 2014 MODULE 1    Introduction;  oop concepts                                    Operators in java Hands on : Basic Java Programs Hands on: Java program using operators Hands on : Basic String programs   Basic string and array questions in java. MODULE 2     Polymorphism and Inheritance MODULE 3    Packages and Interfaces                               Exception Handling                               Design Pattern                      ...