study java

Insertion Sort Program in Java

import java.util.*; public class InsertionSort { public static void main(String[] args) { int arr[] = new int[10]; Scanner sc = new Scanner(System.in); for (int i = 0; i < 10; i++) { System.out.print(“Enter the number ar[” + i + “]:”); arr[i] = sc.nextInt(); } int n = arr.length; int temp, j; for (int i = […]

Deleting Element From Array Program in Java

import java.util.Scanner; public class DeletingElementFromArray { public static void main(String[] args) { int arr[] = new int[10]; Scanner sc = new Scanner(System.in); for (int i = 0; i < 10; i++) { System.out.print(“Enter the number ar[” + i + “]:”); arr[i] = sc.nextInt(); } int n = arr.length; int newarr[] = new int[n – 1]; […]

Adding Element In Array Program in Java

import java.util.Scanner; public class AddingElementInArray { public static void main(String[] args) { int arr[] = new int[10]; Scanner sc = new Scanner(System.in); for (int i = 0; i < 10; i++) { System.out.print(“Enter the number ar[” + i + “]:”); arr[i] = sc.nextInt(); } int n = arr.length; int newarr[] = new int[n + 1]; […]

Java Object Oriented Programming (OOPs) Concepts

Java is an Object Oriented Programming language. There are many object oriented features in java such as Inheritance, Polymorphism, Abstraction, Encapsulation etc.

The first object-oriented programming language is Simula.
Java is known as truly object-oriented programming language because all java programs is written in class.

Short Name Format Program in Java

Short Name Format Program in Java

Words in Sentence Program in Java

Words in Sentence Program in Java, Enter a sentence or string and print its words of string in java.

Sentence Reverse Program in Java

Sentence Reverse Program in Java. Enter a sentence or string and print its reverse string in java.

Selection Sort Program in Java

Selection sort is an in-place comparison sorting algorithm. It has an O(n²) time complexity, which makes it inefficient on large lists, and generally performs worse than the similar insertion sort.

Ugly Number Program in Java

A number is said to be an Ugly number if positive numbers whose prime factors only include 2, 3, 5.
For example, 6(2×3), 8(2x2x2), 15(3×5) are ugly numbers while 14(2×7) is not ugly since it includes another prime factor 7. Note that 1 is typically treated as an ugly number.

Pronic Number Program in Java

A number is said to be a pronic number if product of two consecutive integers is equal to the number, is called a pronic number.
Example- 42 is said to be a pronic number, 42=6×7, here 6 and 7 are consecutive integers

1 2 3 4 6