Posts

Showing posts from 2015

Looking inside an Array

Linear search is simplest searching algorithm to find an element in an array. This example has an array with  6 elements. A key is value that we are looking for inside of an array, and we are looking for value 4. Another integer variable index is used for storing index value of element that has matching value as the key value. We initialize index with arr.length , which it return the size of the array. Out search engine build using for loop. This engine will check all the elements in the array one by one. The if statement inside the loop is where it checks whether value of arr at current location indicated by variable i is same as value of key. If the values are equal we change the index value to value of i . Third part is displaying results. If the value of index not equal to arr.length , that means something has happen inside the loop statement. This something can happen only and only if key is found inside the array. So this if statement actually checks whether the key i

Home

This site is for students learning Java programming language. I have summarized important points about understanding and writing coding by arranging them according to topics.

Object and Class

Image
When creating a class imagine the objects that will be created from that class. To design your class consider this: what are the things that object has this is known as the instance variable   What are the actions that object can do . this is methods Following is a UML diagram depicting a class design This Movie class has two instance variables: title and producer. Value of this variable is unique for an object. We also can say that any two movies have different state because there are no two movies have same title and producer. The methods contain operation to work on the data of the object. A pair of method like setTitle() and getTitle() are also known setter and getter method. The purpose of this pair of method is to give or assign the value for an instance variable and to take or retrieve current value of the instance variable. Class and object A class is not an object. It is used for building and object. A class is a blueprint for an object.

Popular posts from this blog

Drawing Simple Pie Chart

VB.net connecting to SQL Server

VB.net