Saturday, 10 October 2015

Core Java with OCJP_SCJP Language Fundamentals Part-1 __ Java Identifiers and Reserved Words


What is Java?

Java is:
  • Object Oriented
  • Platform independent:
  • Simple
  • Secure
  • Architectural- neutral
  • Portable
  • Robust
  • Multi-threaded
  • Interpreted
  • High Performance
  • Distributed
  • Dynamic

Java Environment Setup:

Java SE is freely available from the link Download Java. So you download a version based on your operating system.
You can refer to installation guide for a complete detail.

Java Basic Syntax:

  • Object - Objects have states and behaviors. Example: A dog has states-color, name, breed as well as behaviors -wagging, barking, eating. An object is an instance of a class.
  • Class - A class can be defined as a template/ blue print that describe the behaviors/states that object of its type support.
  • Methods - A method is basically a behavior. A class can contain many methods. It is in methods where the logics are written, data is manipulated and all the actions are executed.
  • Instant Variables - Each object has its unique set of instant variables. An object's state is created by the values assigned to these instant variables.

First Java Program:

Let us look at a simple code that would print the words Hello World.
public class MyFirstJavaProgram{

   /* This is my first java program.  
    * This will print 'Hello World' as the output
    */

    public static void main(String []args){
       System.out.println("Hello World"); // prints Hello World
    }
} 
About Java programs, it is very important to keep in mind the following points.
  • Case Sensitivity - Java is case sensitive which means identifier Helloand hello would have different meaning in Java.
  • Class Names - For all class names the first letter should be in Upper Case.

    If several words are used to form a name of the class each inner words first letter should be in Upper Case.

    Example class MyFirstJavaClass
  • Method Names - All method names should start with a Lower Case letter.

    If several words are used to form the name of the method, then each inner word's first letter should be in Upper Case.

    Example public void myMethodName()
  • Program File Name - Name of the program file should exactly match the class name.

    When saving the file you should save it using the class name (Remember java is case sensitive) and append '.java' to the end of the name. (if the file name and the class name do not match your program will not compile).

    Example : Assume 'MyFirstJavaProgram' is the class name. Then the file should be saved as 'MyFirstJavaProgram.java'
  • public static void main(String args[]) - java program processing starts from the main() method which is a mandatory part of every java program..

Java Identifiers:

All Java components require names. Names used for classes, variables and methods are called identifiers.
In java there are several points to remember about identifiers. They are as follows:
  • All identifiers should begin with a letter (A to Z or a to z ), currency character ($) or an underscore (_).
  • After the first character identifiers can have any combination of characters.
  • A key word cannot be used as an identifier.
  • Most importantly identifiers are case sensitive.
  • Examples of legal identifiers:age, $salary, _value, __1_value
  • Examples of illegal identifiers : 123abc, -salary

Java Modifiers:

Like other languages, it is possible to modify classes, methods, etc., by using modifiers. There are two categories of modifiers.
  • Access Modifiers : default, public , protected, private
  • Non-access Modifiers : final, abstract, strictfp
We will be looking into more details about modifiers in the next section.

Java Variables:

We would see following type of variables in Java:
  • Local Variables
  • Class Variables (Static Variables)
  • Instance Variables (Non static variables)

Java Arrays:

Arrays are objects that store multiple variables of the same type. However an Array itself is an object on the heap. We will look into how to declare, construct and initialize in the upcoming chapters.

Java Enums:

Enums were introduced in Java 5.0. Enums restrict a variable to have one of only a few predefined values. The values in this enumerated list are called enums.
With the use of enums it is possible to reduce the number of bugs in your code.
For example if we consider an application for a fresh juice shop it would be possible to restrict the glass size to small, medium and Large. This would make sure that it would not allow anyone to order any size other than the small, medium or large.

Example:

class FreshJuice{

   enum FreshJuiceSize{ SMALL, MEDIUM, LARGE }
   FreshJuiceSize size;
}

public class FreshJuiceTest{

   public static void main(String args[]){
      FreshJuice juice = new FreshJuice();
      juice.size = FreshJuice. FreshJuiceSize.MEDIUM ;
      System.out.println("Size :" + juice.size);
   }
}
Note: enums can be declared as their own or inside a class. Methods, variables, constructors can be defined inside enums as well.

Java Keywords:

The following list shows the reserved words in Java. These reserved words may not be used as constant or variable or any other identifier names.
abstractassertbooleanbreak
bytecasecatchchar
classconstcontinuedefault
dodoubleelseenum
extendsfinalfinallyfloat
forgotoifimplements
importinstanceofintinterface
longnativenewpackage
privateprotectedpublicreturn
shortstaticstrictfpsuper
switchsynchronizedthisthrow
throwstransienttryvoid
volatilewhile

Comments in Java

Java supports single line and multi-line comments very similar to c and c++. All characters available inside any comment are ignored by Java compiler.
public class MyFirstJavaProgram{

   /* This is my first java program.
    * This will print 'Hello World' as the output
    * This is an example of multi-line comments.
    */

    public static void main(String []args){
       // This is an example of single line comment
       /* This is also an example of single line comment. */
       System.out.println("Hello World"); 
    }
} 

Friday, 9 October 2015

Comedy Nights With Kapil 4th September (2015) Episode 179

                                                         ||Comedy Nights With Kapil||
                                            [200MB | 480P | WebHD | x264]
                              
                         Poster Of Comedy Nights With Kapil (2015) Free Download Full New Hindi Comedy Show Watch Online At worldfree4u.com

                        Language: Hindi
                        Genre(s): Comedy
                        Released On: 4th September 2015


                     Comedy Nights With Kapil 4th September 2015

                   Resumable Mediafire Download Link For Hindi Show Comedy Nights With Kapil (2015) 4th September 2015 Watch Online Download
                    
                   
                                                                                     
                                               ||Download Movie Via Single Resumable 196MB Links||


                                                                    


                                                            

Vedalam Official Teaser | Ajith, Shruti Hassan | Anirudh , Siva


                                             





C Environment Setup


This section describes  how to set  up your system environment before you start doing your
programming using C language.
Before you start doing programming using C programming language, you need the following
two softwares available on your computer, (a) Text Editor and (b) The C Compiler.

Text Editor :- 

This will be used to type your program. Examples of few editors include Windows Notepad,
OS Edit command, Brief, Epsilon, EMACS, and vim or vi.
Name  and  version  of  text  editor  can  vary  on  different  operating  systems.  For  example,
Notepad will be used on Windows, and vim or vi can be used on windows as well as Linux or
UNIX.
The  files  you  create  with  your  editor  are  called  source  files  and  contain  program  source
code. The source files for C programs are typically named with the extension “.c”.
Before  starting  your  programming,  make  sure  you  have  one  text  editor  in  place  and  you
have enough experience to write a computer program, save it in a file, compile it and finally
execute it.

The C Compiler :- 

The  source  code  written  in  source  file  is  the  human  readable  source  for  your  program.  It
needs  to  be  "compiled",  to  turn  into  machine  language  so  that  your  CPU  can  actually
execute the program as per instructions given.
This  C  programming  language  compiler  will  be  used  to  compile  your  source  code  into  final
executable  program.  I  assume  you  have  basic  knowledge  about  a  programming  language
compiler.
Most frequently used and free available compiler is GNU C/C++ compiler, otherwise you can
have compilers either from HP or Solaris if you have respective Operating Systems.
Following  section  guides  you  on  how  to  install  GNU  C/C++  compiler  on  various  OS.  I'm
mentioning  C/C++  together  because  GNU  gcc  compiler  works  for  both  C  and  C++
programming languages.


Installation on  UNIX/Linux  :-

If  you  are  using Linux  or  UNIX, then  check  whether  GCC  is  installed  on  your  system  by
entering the following command from the command line:

                                    $ gcc -v

If  you  have  GNU  compiler  installed  on  your  machine,  then  it  should  print  a  message
something as follows:
                                    Using built-in specs.
                                    Target: i386-redhat-linux
                                    Configured with: ../configure --prefix=/usr .......
                                    Thread model: posix
                                    gcc version 4.1.2 20080704 (Red Hat 4.1.2-46)

If  GCC  is  not  installed,  then  you  will  have  to  install  it  yourself  using  the  detailed
instructions available athttp://gcc.gnu.org/install/
This  tutorial  has  been  written  based  on  Linux  and  all  the  given  examples  have  been
compiled on Cent OS flavor of Linux system.

Installation on Mac OS :-

If you use Mac OS X, the easiest way to obtain GCC is to download the Xcode development
environment from Apple's web site and follow the simple installation instructions. Once you
have Xcode setup, you will be able to use GNU compiler for C/C++.
Xcode is currently available at developer.apple.com/technologies/tools/.

Installation on Windows :-

To install GCC at Windows you  need to install MinGW.  To install MinGW, go to the MinGW
homepage,  www.mingw.org,  and  follow  the  link  to  the  MinGW  download  page.  Download
the  latest  version  of  the  MinGW  installation  program,  which  should  be  named  MinGW-<version>.exe.
While  installing  MinWG,  at  a  minimum,  you  must  install  gcc-core,  gcc-g++,  binutils,  and
the MinGW runtime, but you may wish to install more.
Add the bin subdirectory of your MinGW installation to your PATH environment variable,  so
that you can specify these tools on the command line by their simple names.
When the installation is complete, you will be able to run gcc, g++, ar, ranlib, dlltool, and
several other GNU tools from the Windows command line.

Prem Ratan Dhan Payo Official Trailer - Full Video HD