Author Topic: Introduction To Java Programming - Article  (Read 2443 times)

Offline certforumz

  • Cert Exams
  • Administrator
  • Hero Member
  • *****
  • Posts: 600
  • Ask me a question ...
    • CertExams - CCNA, A+, Network+, and Others
Introduction To Java Programming - Article
« on: May 13, 2012, 09:01:39 PM »
Introduction To JavaJava is a high-level programming language developed by Sun Microsystems. Java was originally called OAK, and was designed for handheld devices and set-top boxes.

Some features of java:
1. Simple: Some of the features that make java a simple language are no direct use of pointers, strong memory management, automatic memory allocation and deallocation.
2. Portable: Java language is portable as programs written in java can be run on any system having interpreter for JVM. Also, java has standard size irrespective of operating system or processor.
3.   Robust: Features that make java robust include powerful exception handling, type checking mechanism, strong memory allocation and automatic garbage collection mechanism.
4.  Architecture neutral: Code written in java is compiled into byte code instructions which can be interpreted on any machine using JVM and can be easily translated into native machine code. Also, compiler generates an architecture-neutral object file format that enable a Java application to execute anywhere on the network.
5. Object oriented: Java is an object-oriented language it uses all object-oriented concepts including classes, objects, Inheritance, polymorphism, data binding. Also java has an extensive class library in core language package.
6. Secure: All the programs in java are run in virtual machine sand box. Java uses the public key encryption system to allow the java applications to transmit over the Internet in the secure encrypted form. The byte code Verifier checks the classes after loading, class loader confines objects to unique namespace and security manager determines the accessibility options of a class like reading and writing a file to the local disk.
7. Threading: Threads can be used in java for multiprocessing.

Object Oriented Concepts:
1. Classes: A class is a structure that defines data and functions to operate/modify/work on that data.
2. Objects :Object is a feature of a class, which is used for working on the particular properties of the class. A class can have any number of objects in memory at one time
3. A Method is a set of code, which is referred to by name and can be called (invoked) at any point in a program simply by utilizing the method's name. A method has a signature consisting of its name and the number and types of its parameters (also called arguments or actual parameters). The parameters in the declaration of the method are its formal parameters. 
4. The two kinds of polymorphism that can be implanted in java are overloading and overriding
5. Abstract classes: An abstract class is declared using ?abstract? keyword. It allows putting all common method names in one class without writing the actual implementation code. An abstract class mayor may not have abstract methods. It cannot be instantiated, but can be extended into sub-classes.   6. Abstract method: An abstract method is a method that is declared without an implementation (without braces, and followed by a semicolon) 
 7. Inheritance: Object-oriented programming allows classes to inherit commonly used state and behavior from other classes. Classes can be derived from other classes, thereby inheriting fields and methods from those classes. 
 8. An inner class is a class declared within another class. The four kinds of inner class are Member class, Static member class, Local inner class, Anonymous inner class.

Java language basics:
1. Instance Variables : These are Non-Static Fields. Individual states of objects are stored in Instance variables. These are declared without the static keyword. For number of objects created from a class all objects use same copy of instance variable.   
2. Class Variables : These are Static Fields. These are declared using static modifier. There will be only one copy of each class variable per class for all the objects created from that class. 
3. Local Variables : The syntax for declaring a local variable is similar to declaring a field (for example, int count = 0;).These are created when a method, block or constructors are entered and destroyed when it exits. There are no default vales for local variables and internally these are maintained at stack level.
4. Java Has eight primitive data types int, byte, short, long, float, double, char and Boolean. Java also has reference data types and literal which is source code representation of a fixed value.
5. An Enums is a class with a fixed number of instances that are defined within the class itself. Enums are used where there is a small, unchanging, predefined set of values, such as the days of the week.
6. Modifiers are Java keywords that provide information to compiler about the nature of the code, data and classes. 
7. Access Modifiers are Private, Public and protected. Non-Access Modifiers are Abstract, Static, Native, Final, synchronized, volatile and transient.
8. A thread is a program's path of execution. Most programs written today run as a single thread, causing problems when multiple events or actions need to occur at the same time.
9. There are two ways of creating threads implementing an interface and extending an class. 
10. States of a thread are Yielding, Sleeping, Waiting, Suspended, Blocked.
11. Java leaves the implementation of thread scheduling to JVM developers. Two types of scheduling that can be used are Pre-emptive Scheduling and Time-sliced or Round Robin Scheduling .
12. Generics: The feature Generics in java allows a programmer to create classes and objects that can operate on any defined types. It allows clients to substitute a suitable java type at the compile time preventing un necessary type casting being done in application code. 
13. Generic methods are defined using type parameters.Every generic method has a type parameters section that precedes the return type of the method. The type parameters are separated by commas and enclosed in angle brackets < and >. Type parameters also known as type variables are identifiers that specify generic type names. 
14. Just as Generic methods you can define Generic classes. In this case, the type parameters are enclosed in angle brackets < and > and placed after name of the class and a type parameter is used to declare variables and generic methods with in the class   
15. Bounded Type Parameters: Some times you will need to restrict the kind of types that are allowed to be passed to a type parameter For example a method that operates on numbers might only want to accept instances of Number or its subclasses (Integer, float etc.). 
16. Wild card types are used for putting restrictions on the types that are used in generic programming. These are used as type parameters in the declarations of variables and of formal parameters in method definitions. 
You may read entire article Introduction to Java at Oracle is offering Java certifications at Associate and Professional lever (SCJP). Read more about Java Certification.

 1. sun certified programmer for java 6 study guide by katherine sierra and bert bates