Udjuni.com

udjuni.com search:




Introduction to Java programming


Computer program as we learned in the posting Introduction to Programming is a set of instructions that guide a computer to execute a particular task. It is synonymous to a recipe in a cook book. In which case the recipe has a list of ingredients called the data or variables, and a list of steps that tells the computer what to do with the data. Thus in short, programming is the technique of making a computer to perform something you want it to do. Programming or coding as it is commonly known in the programming world is the act of giving such instructions (usually in a high-level language) to a computer, which are then translated into binary language (0s and 1s) that a computer can understand.

Java programming the introduction


Java is a high-level programming language, part of what is commonly known as object-oriented programming languages. The notion to this is that every problem you try to solve is depicted as an object, thus solving the problems of any object by changing the attributes and behavior of such an object. Thus a normal java source code file will have a class definition, within that class we define the attributes of its objects by means of variables, we also define methods in which the behavior of the objects is coded. Once we are done, we can define an object of the class, outside of the class definition and that object can be used to call methods of the class and set its properties.


Bellow is an example of a Java class definition:
import java.io.*;
class HelloWorld{
private int counter = 0;

public void displayContent(int moveby){

this.counter += moveby;
System.out.println("Moved position to" + this.counter);
}
}

//usage:
HelloWord word = new HelloWorld();
word.displayContent(5); // displays : Moved position to 5 if
starting point was 0 before the call


Note that every statement in Java ends with a semicolon (;) and the class definition starts with class (small letters) with the class name starting with Capital letters. It is also considered good naming convention for variables and methods to start with small letters.

In the next few posting we will take a look at advanced java programming.




RELATED ARTICLES:


Introduction to Programming
What exactly is programming? Programming can be defined as the art of telling a computer to do whatever you want it to. If you are reading this posting you probably started off with switching the computer on and then opened the browser that got you to this page. Every comp

Starting to program in Java
Most java developers would describe it as an innovative programming language that enables a developer to write what is called "Applets" or pieces of java code that can be embedded in web pages. In addition to this benefit, compiled java code can be run on a variety of

Compiling and executing a java program
Java source code is always stored in a file with a .java file extension. Once you have created your source code, you simply save it with a .java extension and it is ready to be compiled. To compile your java code, you use the f

Java variables and data types
A variable is defined as a named piece of memory that a java program uses to store data. Each of these storage pieces can only store data of a certain type. In other words, if you defined as variable of type integer, that variable can only hold inte

Introduction to Accounting


Introduction to Operations Management
Operations management encompasses the process of how businesses produce goods and/or services. This involves responsibilities, activities and decisions of those tasked with managing production processes. Almost everything we use, eat or wear is made somewhere, possibly a manufacturing plant or simil

Introduction to HTML
HTML is a computer language used to create websites. The fact that you are looking at this page, means you are also looking at the outcome of html code. It is relatively easy to learn, with the majority of what you really need to know being readily available and for free on the internet.

Introduction to SQL
The term SQL stands for structure query language. It consists of a set of command that humans use to instruct a computer to store, modify and retrieve information. This posting and a few more to come will discuss the commands used to create/allocate storage space, how data is stored,

PHP Objects and classes
Object oriented programming is defined to be a programming paradigm that uses objects or data structures consisting of datafields and methods. This paradigm is also composed of interactions among datafields and methods. The program

Introduction to Geometry
By definition geometry is considered to be the study of space, shapes and their configurations. Almost every one of us use geometry on a daily basis ranging from computer scientist, to engineers to less sophisticated and ordina

Did not find it? Try udjuni.com search:







© 2009 UdjunI LLC. All rights reserved | Privacy policy | Tutorial Index | RSS Feed