Top Banner
MADE BY: SHELDON ABRAHAM IX A 38
20
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Knowledge of Javascript

MADE BY: SHELDON ABRAHAM

IX A

38

Page 2: Knowledge of Javascript
Page 3: Knowledge of Javascript

INTRODUCTION

Java is a computer programming language that is concurrent, class based object-oriented , and specifically designed to have as few implementation dependencies as possible.

Java applications are typically compiled to byte code that can run on any Java virtual machine (JVM) regardless of computer architecture.

Page 4: Knowledge of Javascript

Java is, as of 2014, one of the most popular

programming languages in use, particularly for

client-server web applications, with a reported 9

million developers.

Java was originally developed by James

Gosling at Sun Microsystems and released in

1995 as a core component of Sun

Microsystems' Java Platform.

The language derives much of

its syntax from C and C++, but it has fewer low-

level facilities than either of them.

Page 5: Knowledge of Javascript

HISTORY

On 23 May 1995, John Gage, the director of the ScienceOffice of the Sun Microsystems along with Marc Andreesen,co-founder and executive vice president at Netscapeannounced to an audience of Sun World that Javatechnology wasn't a myth and that it was a reality and that itwas going to be incorporated into Netscape Navigator.

At the time the total number of people working on Java wasless than 30. This team would shape the future in the nextdecade and no one had any idea as to what was in store.From being the mind of an unmanned vehicle on Mars to theoperating environment on most of the consumer electronics,e.g. cable set-top boxes, VCRs, toasters and also forpersonal digital assistants (PDAs). Java has come a longway from its inception. Let's see how it all began.

Page 6: Knowledge of Javascript

Before Java emerged as a programming language, C++ was the dominant player in the trade. The primary goals that the creators of Java was to create a language that could tackle most of the things that C++ offered while getting rid of some of the more tedious tasks that came with the earlier languages.

Behind closed doors, a project was initiated in December of 1990, whose aim was to create a programming tool that could render obsolete the C and C++ programming languages. Engineer Patrick Naughton had become extremely frustrated with the state of Sun's C++ and C APIs (Application Programming Interfaces) and tools.

Page 7: Knowledge of Javascript

OBJECTIIVES

There were five primary goals in the

creation of the Java language.

It should be "simple, object-oriented and

familiar"

It should be "robust and secure"

It should be "architecture-neutral and

portable"

It should execute with "high performance"

It should be "interpreted, threaded, and

dynamic"

Page 8: Knowledge of Javascript

PROPERTIES

Various features of java programming language are as given below-

1.Java is very simple programming language. Even though you have no

programming background you can learn this language comfortably.

2.Java is popular because it is an object oriented programming language like

C++.

3.Platform independence is the most exciting feature of java. That means

programs in java can be executed on variety of systems. This feature is based

on the goal

“write once, run anywhere and at anytime, forever”.

4.Java supports multithreaded programming which allows a programmer to

write

such a program that can be perform many tasks simultaneously.

5.Thus robustness is the essential criteria for the java programs.

6.Java is designed for distributed systems. Hence two different objects on

different

computer can communicate with each other.This can be achieved by

Page 9: Knowledge of Javascript

VARIABLES

There are four kinds of variables.

Instance variables: These are variables that are used to store the state of an object (for example, id). Every object created from a class definition would have its own copy of the variable. It is valid for and occupies storage for as long as the corresponding object is in memory.

Class variables: These variables are explicitly defined within the class-level scope with a static modifier (for example, is Class Used). No other variables can have a static modifier attached to them. Because these variables are defined with the static modifier, there would always be a single copy of these variables no matter how many times the class has been instantiated. They live as long as the class is loaded in memory.

Parameters or Arguments: These are variables passed into a method signature (for example, parameter). Recall the usage of the args variable in the main method. They are not attached to modifiers (i.e. public, private, protected or static) and they can be used everywhere in the method. They are in memory during the execution of the method and can't be used after the method returns.

Local variables: These variables are defined and used specifically within the method-level scope (for example, current Value) but not in the method signature. They do not have any modifiers attached to it. They no longer exist after the method has returned.

Page 10: Knowledge of Javascript

OPERATORS

Unary operators are those operators that operate on a single variable, such as increment and decrement (++), positive and negative signs (+ –), the bit-wise NOT operator (~), the logical NOT operator (!), parentheses, and the new operator.

Arithmetic operators are those operators used in mathematical operations. Here it is important to note that this table is read from left to right, therefore multiplication and division have greater precedence than addition and subtraction.

Page 11: Knowledge of Javascript

Assignment operators includes the familiar

assignment (=) operator as well as a set of

additional assignment operators referred to

generically as op= (operator equal). These new

operators are shortcut operators used when

performing an operation on a variable and

assigning the result back to that variable.

Ternary operator is rarely used, and is mainly

inherited from Java's initial syntactical base

from C/C++. It is a somewhat cryptic shortcut,

but is perfectly legal

Page 12: Knowledge of Javascript

DECISION MAKING

If – The Conditional The if statement evaluates an expression and if that

evaluation is true then the specified action is taken

if ( x < 10 ) x = 10;

If the value of x is less than 10, make x equal to 10

It could have been written:

if ( x < 10 )

x = 10;

Or, alternatively:

if ( x < 10 ) { x = 10; }

Page 13: Knowledge of Javascript

If… else The if … else statement evaluates an expression and performs one

action if that evaluation is true or a different action if it is false.

if (x != oldx) {

System.out.print(“x was changed”);

}

else {

System.out.print(“x is unchanged”);

}

Nested if … elseif ( myVal > 100 ) {

if ( remainderOn == true) {

myVal = mVal % 100;

}

else {

myVal = myVal / 100.0;

}

}

else

{

System.out.print(“myVal is in range”);

}

Page 14: Knowledge of Javascript

else if Useful for choosing between alternatives:

if ( n == 1 ) {

// execute code block #1

}

else if ( j == 2 ) {

// execute code block #2

}

else {

// if all previous tests have failed, execute code

block #3

}

Page 15: Knowledge of Javascript

A Warning…WRONG!

if( i == j )

if ( j == k )

System.out.print(

“i equals k”);

else

System.out.print(

“i is not equal to j”);

CORRECT!

if( i == j ) {

if ( j == k )

System.out.print(

“i equals k”);

}

else

System.out.print(“i is not equal to j”); //

Correct!

Page 16: Knowledge of Javascript

The switch Statementswitch ( n ) {

case 1:

// execute code block #1

break;

case 2:

// execute code block #2

break;

default:

// if all previous tests fail then

//execute code block #4

break;

}

Page 17: Knowledge of Javascript

The for loop Loop n times

for ( i = 0; i < n; n++ ) {

// this code body will execute n times

// ifrom 0 to n-1

}

Nested for:

for ( j = 0; j < 10; j++ ) {

for ( i = 0; i < 20; i++ ){

// this code body will execute 200 times

}

while loopswhile(response == 1) {

System.out.print( “ID =” + userID[n]);

n++;

response = readInt( “Enter “);

}

Page 18: Knowledge of Javascript

do {… } while loopsdo {

System.out.print( “ID =” + userID[n] );

n++;

response = readInt( “Enter ” );

}while (response == 1);

A break statement causes an exit from the innermost

containing while, do, for or switch statement.

for ( int i = 0; i < maxID, i++ ) {

if ( userID[i] == targetID ) {

index = i;

break;

}

} // program jumps here after break

Page 19: Knowledge of Javascript

Continue Can only be used with while, do or for.

The continue statement causes the innermost loop to start the

next iteration immediatelyfor ( int i = 0; i < maxID; i++ ) {

if ( userID[i] != -1 ) continue;

System.out.print( “UserID ” + i + “ :” +

userID);

}

Page 20: Knowledge of Javascript