Bluej for ICSE

A Complete reference to ICSE bluej

Searching in Java – Video Tutorial — May 30, 2017

Searching in Java – Video Tutorial

Hey there!
Sorry for not posting updates on this blog. I’m currently busy with my Primary Blog (http://blog.techraj156.com)

Anyway, In this video tutorial, I explained everything about the Searching technique in Java which includes,

  1. Linear Search
  2. Binary Search

Don’t forget to subscribe to our Youtube channel for more tutorials like these.

Please also check out my official website https://techraj156.com and also our official blog http://blog.techraj156.com

Here is the video 🙂

Sorting in Java – Video Tutorial — January 2, 2017

Sorting in Java – Video Tutorial

Learn about Array Sorting in Java Programming!

Generally, there are two types of Sorting in Java, they are,

1.Selection Sort

2.Bubble Sort

Watch this video tutorial about Sorting in Java
Subscribe to me on Youtube for more videos!

 

1.Selection Sort

class SelectionSort
{
static void test()
{
int[] arr = {1,5,45,23,47,25,45}; //initializing an integer type array
int n = 7; //n = no. of elements in the array
for(int i = 1;i<=n;i++) //performing the logic ‘n’ types
{
for(int j=0;j<(n-1);j++)
{
int a = arr[j]; //storing the element at ‘j’ th position in the variable ‘a’
int k = j+1; //keeping the value of ‘k’ ahead of one position with respect to ‘j’
int b = arr[k]; //storing the element at ‘k’ th position in the variable ‘b’

if(b<a) //if the condition is satisfied, then control goes inside the loop
{ //exchanging the positions of the elements of array.
int temp1=a; //storing the value of a in temporary variable temp1
int temp2=b; //storing the value of a in temporary variable temp2

arr[j] = temp2; //replacing the existing element at ‘j’ th postion with the new integer element ‘temp2’
arr[j+1] = temp1; //replacing the existing element at ‘j+1’ th postion with the new integer element ‘temp2’

}
}
}
for(int d = 0;d<7;d++) //Printing out the sorted array in ascending order
System.out.print(arr[d]+ ” “);
}
}

2.Bubble Sort

class BubbleSort
{
static void test()
{
int arr[] = {23,58,47,2,156,847,12}; //intializing an integer type array array
int n = 7; //n = no of elements in the array

System.out.println(“The Sorted Array is “);
for(int i=0;i<=(n-1);i++) //Iterating the logic (n-1) times
{
for(int j=0;j<6;j++) //Making changes with the array
{
int k = j+1;
int a = arr[j];
int b = arr[k];
if(b<a) //Comparing adjacent elements of the array
{
int temp1 = a; //storing the value of a in temp1
int temp2 = b; //storing the value of b in temp2
arr[j] = b; //exchanging posistions
arr[k] = a; //exchanging posistions
}

}
}
for(int d = 0;d<7;d++) //Printing the sorted array
System.out.print(arr[d]+” “);
}
}

 

Create an Android Application with Java if you are interested (Not included in ICSE syllabus) — November 19, 2016
Program in Java to Accept a Sentence from the user, and store each word of the Sentence in an Array. — November 5, 2016

Program in Java to Accept a Sentence from the user, and store each word of the Sentence in an Array.

Sample Input : Loyola Public School

Sample Output : The Elements of the Array are : Loyola, Public, School

 

import java.util.*;
class StringArray
{
static void teja()
{
Scanner in = new Scanner(System.in);
System.out.println(“Enter the sentence :”);
String st = in.nextLine();
st = st+” “;
int l = st.length();
int k =0;
for(int i=0;i<l;i++)
{
char ch = (char)st.charAt(i);
if(ch==32)
k++;
}
if(k==0)
{
System.out.println(“Please Enter a Sentence with atleast 2 words”);
}
else
{
int temp = 0;
int temp1 = 0;
String[] arr = new String[k];
for(int i = 0;i<st.length();i++)
{
char ch = (char)st.charAt(i);
if(ch==32)
{
arr[temp] = st.substring(temp1,i);
temp1 = i;
temp++;
}
}
System.out.println(“Elements of the Array are : “);
for(int i=0;i<arr.length;i++)
System.out.print(arr[i]+”, “);
}
}
}

Looping in Java Programming — October 24, 2016
Palidrome Video ! _Bluej For ICSE — July 11, 2016
A Program in Java to reverse the Given String(Method 2) — July 10, 2016
A Program in Java to Reverse the given String(Method 1) — July 5, 2016
A Program to find the Sum of Two digits Bluej For ICSE — July 3, 2016