Showing posts with label keywords. Show all posts
Showing posts with label keywords. Show all posts

Monday, 22 February 2016

Javascript - Programs Basic

Javascript Programs
In a programming language, computer program instructions are called statements.
JavaScript is a programming language and JavaScript statements are separated by semicolons.

Example:
var a = 1;
var b = 2;
var c = a + b;

And next is the javascript statements, and it includes 

  • values
  • operators
  • expressions
  • keywords and 
  • comments

JS Values:
JS values are two types, literals (fixed values) and variables

Numbers - 10.50,100
String - with single or double quote"name"

Variables:
Variables are used to store data values. JS uses var keyword to assign variables.
Eg: 
var x;
x=10;

Operators:
JS uses an assignment operator ( = ) to assign values to variables: 
var a=90;
JS uses arithmetic operators ( + - *  / ) to compute values: 
a * 10 (expressions)
also in string level
 "Mark" + " " + "Layer", evaluates to "Mark Layer":

Comments:
Code after double slashes // or between /* and */ is treated as a comment.Comments are ignored, and will not be executed:

Eg:
var a = 50;   // I will be executed

// var a = 50;   I will NOT be executed

JS Statements:
JS statement tells the browser to write "I am in." inside an HTML element with id="example":
Example:
document.getElementById("example").innerHTML = "I am in.";

One program example:

var a = 5;
var b = 6;
var c = a + b;
document.getElementById("example").innerHTML = c;


Friday, 11 January 2013

Java Keywords

Keywords in Java

Java language has reserved 49 words as keywords.


Java Keywords also called a reserved word. Keywords are identifiers that Java reserves for its own use. These identifiers have built-in meanings that cannot change. Thus, programmers cannot use these identifiers for anything other than their built-in meanings. Technically, Java classifies identifiers and keywords as separate categories of tokens. Keywords are an essential part of a language definition. There are 49 reserved keywords currently defined in the Java language and they are shown in the below table.


abstract
double
int
switch
assert
else
interface
synchronized
boolean
extends
long
this
break
false
native
throw
byte
final
new
transient
case
finally
package
true
catch
float
private
try
char
for
protected
void
class
goto
public
volatile
const
if
return
while
continue
implements
short
default
import
static
do
instanceof
super


The keywords const and goto are reserved but not used. In the early days of Java,several other keywords were reserved for possible future use.