Showing posts with label Java and Programing. Show all posts
Showing posts with label Java and Programing. Show all posts

Sunday, 2 October 2011

Primitive data types

1. What is primitive data type ? A basic primitive data type is either of the following:
a.Numbers
i. Whole numbers
-– bytes = 8 bits –1 Bytes
--- Short = 16 bits – 2 Bytes
--- Int / Integer = 32 bits – 4 Bytes
--- Long integer = 64 bits ---- 8 Bytes

Operation involve in whole numbers : +,­,*,/ .If there more than one operator in an arithmetic operation,look at its priority . Operation priority first (* / ),followed by            (+ -).Example :
4-2*5 = -6
4*5/2 = 10

For remainder,we use modulus aka % example,15%6 = 15 MOD 6 = 3 .More example :
8%4 = 0
8%3=2
21%5=1
15%6=3

Operator – Prefix
             -- Postfix
                
 ii.Real numbers ( with decimal)
---Float – 4 Byte – Single precision
---Double – 8 Byte – Double precision

b. Alphaneumeric – Combination of numbers and alphabet ,example SKJ 1013

c. False / True (Boolean).It uses 3 logical operator :
AND - &&
OR = II
NOT = !

And uses relational logic operator :
>
>=
< 
<=
== Equivalent,Example ( n=0,ie n is assigned to 0),but (n==0 ie is n equal to 0? )
!= Not equal

Wednesday, 28 September 2011

Introduction to Computers,Programs & Java (part 2) operating systems,programming language

1. Operating systems - manage,control activities that runs on computer.

2. Example,Linux,Mac os,Microsoft windows,Mobile Os.

3.The major tasks including :
   i.Control and monitor system activities
   ii.Allocate and assigning resources
   iii.Scheduling operations

4.Programming language

i. Binary code
- 11001110 
- consist entirely of numbers and are almost impossible for humans to read and write.
   
ii.Assembly language/ low level language
- Assembly languages have the same structure and set of commands as machine languages, but they enable a programmer to use names instead of numbers.

Example assembly language















iii. High level language
-high-level language is called so because they are closer to human languages and further from machine languages. In contrast, assembly languages are considered low-level because they are very close to machine languages.

-The main advantage of high-level languages over low-level languages is that they are easier to read, write, and maintain. Ultimately, programs written in a high-level language must be translated into machine language.

- There are two ways to run programs written in a high-level language. The most common is by using compiler,; the other method is to pass the program through an interpreter.


 

Introduction to Computers,Programs & Java (part 2) The storage capacity

Storage device
1. Every memory device has a storage capacity.

2.The storage capacity (example,256 MB,1GB,2GB etc ) indicates the number of bytes it can hold.

3.Computer data is using binary system that consists of ones and zeros in a string or line.

4. Each string has eight set of binary number (zeros and ones) that we call them as bits.Meaning,1 string = 8 bits.

5. 8 bits = 1 Bytes 

6.Example,00000100 = 1Byte

7.1 Byte = 1 Character.

8.Example,the capital letter "K" is expressed in binary system as 01001011.

9.1 Bytes is the smallest amount of transfer.

10.Example,a Gif image with 4 kB,equal to 4 kilo bytes (4000) bytes.Meaning,it has 4000 thousand set of string,with 8 bits each string.Example :
00000001
00000010
00000100
00001000
.
.
.
.
.
 (until 4000 strings)

Hence,4000 strings (bytes) x 8 bits = 32,000 thousands of bits (0 and 1) for single gif image.

11.Do remember that,KB = Kilo Byte and Kb=Kilo bits.

12.A kB is 8 times larger than kb.Why,kb = 1000 bits,while kB = 1000 (00000000).

13.Mathematically,1 kB = 1000 bytes.Actually, 1 kB is not equal to 1000,but 1024.This is because,mostly computer memory used traditional measurement instead of modern measurement aka SI units aka Metrix system.


14.See below,traditional and modern measurement:
Figure 1 : indicates the traditional measurement that widely used in memory system.

Figure 2 : the green marks indicate the traditional measurement.While white marks indicate the SI standard that we commonly used in life.
Hence,
15.1kb/kilo bits /Kbps = 1024 bits = 128 bytes 
16.1024 bytes = 1 kilo bytes
17.1024 kilobytes = 1MB
18.1024 MB = 1 GB
19.1024 GB = 1 Tera Bytes

Introduction to Computers,Programs & Java (part 1)

Under the topic,we will cover several aspects,they are,
1. Hardware
2. Software
3. Computer and its components
4. an operating system

1.Hardware
Refers to objects that we can actually see and touch, like disks,display screens, keyboards, printers,processor,memory and chips.Refer figure 1 and 2
Figure 1 : Refer to figure,system unit also called peripheral device.
Figure 2 : shows,an example of hardware (hard disk).Everything that's currently "in the computer" is actually stored on that hard disk
2.Software
In contrast, software is untouchable. Software exists as ideas, concepts, and symbols.Examples,microsoft word,internet explorer.Handphone,Atm machine is an example of applications developed using proggraming language.

3.Computer and its components
a. Central processing unit /CPU /processor.

Two type of processor :
i. ALU /Aritmethic Logic Unit - performs arithmetic (addressing 4 basic operations,addition,substraction,multiply,division with integers,real number etc )and logical operations.
ii. CU / Control Unit - extracts instructions from memory and decodes

b. Memory.
Memory can refer to many types of memory within computer,but normally we refered to RAM / Random acces memory

There's too much "stuff" on our computer's hard disk to use it all at the same time. During the session sitting in front of the computer, we will probably use only a small amount of all that's available. The stuff we working with at given moment is stored in random access memory (often abbreviated RAM).


So if RAM is so fast, why not we put everything in it? Why have a hard disk at all? The answer to that lies in the fact that RAM is volatile. As soon as the computer is shut off, whether intentionally or by an accidental power outage, every thing in RAM disappears, just as quickly as a light bulb goes out when the plug is pulled. So you don't want to rely on RAM to hold everything. A disk, on the other hand, holds its information whether the power is on or off. 

Hence,all the information is stored on our computer's hard disk. we will  never see the actual hard disk because it's sealed inside a special housing and needs to stay that way. Unlike RAM, which is volatile, the hard disk can hold information forever -- with or without electricity. 

c.Storage devices -Floppy dicks,zip disc
d.Input and output devices- Keyboard,mouse,speaker
e.Communication devices-Broadband,router