Suga java training_with_footer

20
SUGA Java Knowledge Base SUGA Consulting Services [email protected] www.sugaconsulting.in Office No.26, TNHB Complex, 180, Luz Church Road, Mylapore, Chennai – 600004 Mob No: 9840114766

Transcript of Suga java training_with_footer

Page 1: Suga java training_with_footer

SUGA Java Knowledge Base

SUGA Consulting Services

[email protected]

Office No.26, TNHB Complex, 180, Luz Church Road, Mylapore, Chennai – 600004

Mob No: 9840114766

Page 2: Suga java training_with_footer

Program StructureSNo Topic Duration

1 Introduction to Java,OOPs Concepts 4 hrs

2 Primitive Data Types,Wrapper Classes,String,String Buffer and String Tokenizer,

4hrs

3 Util Package and IO Package 4hrs

4 Threads and Exception Handling 4hrs

5 Access Modifiers ,Methods ,Constructors,Coding Standards

4hrs

6 Database concepts, JDBC 4hrs

7 Log4j ,JDBC,Juint,UML 4hrs

8 Mini Project 4hrs

9 Mini Project 4hrs

10 Mini Project 4hrs

Page 3: Suga java training_with_footer

Java BasicsIt is an Opensource

It is Platform Independent.

Latest version is 1.8

Mobile Applications, Robust Web Applications

Page 4: Suga java training_with_footer

OOPs ConceptsAbstractionEncapsulationPolymorphismInheritance

Page 5: Suga java training_with_footer

OOPs ConceptsAbstraction

You can create an unimplemented method and use it in the implemented/inherited class If a class is abstract and cannot be instantiated, the class does not have much use unless it is subclass. This is typically how abstract classes come about during the design phase. A parent class contains the common functionality of a collection of child classes, but the parent class itself is too abstract to be used on its own.

Encapsulation Encapsulation can be described as a protective barrier that prevents

the code and data being randomly accessed by other code defined outside the class. Access to the data and code is tightly controlled by an interface

Polymorphism

Inheritance

Page 6: Suga java training_with_footer

OOPs ConceptsPolymorphism

Overloading Overloaded method Must change the argument list Can change the return type Can change the access modifier(Broader) Can declare new or broader checked

exception

Page 7: Suga java training_with_footer

OOPs ConceptsPolymorphism

Overriding Overriding method can not have more restrictive access

modifier than the method being overriden but it can be less The argument list must exactly match that of the overriden

method, if they don’t it is more likely that you are overloading the method

Return type must be the same as, or subtype of the return type declared in overriden method in Super class

Overriding method can throw any unchecked exception(Runtime) but it can throw checked exception which is broader or new than those declared by the overriden method but it can not throw fewer or narrow checked exception

Page 8: Suga java training_with_footer

OOPs ConceptsInheritance

Java Inheritance defines an is-a relationship between a superclass and its subclasses. This means that an object of a subclass can be used wherever an object of the superclass can be used. Class Inheritance in java mechanism is used to build new classes from existing classes. The inheritance relationship is transitive: if class x extends class y, then a class z, which extends class x, will also inherit from class y.

Page 9: Suga java training_with_footer

Primitive Data Types, Wrapper Classes Type of Primitives Char Boolean Byte Short Int Long Double Float Note*:  In order to take the benefit of an object from primitives

you need to make use of Wrapper classes.

Page 10: Suga java training_with_footer

String, String BufferA String is immutable, i.e. when it's created, it can

never change.A StringBuffer (or its non-synchronized

cousin StringBuilder) is used when you need to construct a string piece by piece without the performance overhead of constructing lots of little Strings along the way.

The maximum length for both is Integer.MAX_VALUE, because they are stored internally as arrays, and Java arrays only have an int for their length pseudo-field.

The performance improvement between Strings and StringBuffers for multiple concatenation is quite significant

Page 11: Suga java training_with_footer

Util Package Java.util package contains the collections

framework, legacy collection classes, event model, date and time facilities, internationalization, and miscellaneous utility classes.

The important ones are :HashMapStringTokenizerArrayListDate,Calendar

Page 12: Suga java training_with_footer

IO Package Java.io package provides classes for system

input and output through data streams, serialization and the file system.

FileReaderFileWriterBufferedReaderBufferedWriter

Page 13: Suga java training_with_footer

Exception HandlingChecked exceptions: A checked exception is an exception that is

typically a user error or a problem that cannot be foreseen by the programmer. For example, if a file is to be opened, but the file cannot be found, an exception occurs. These exceptions cannot simply be ignored at the time of compilation.

Runtime exceptions: A runtime exception is an exception that occurs that probably could have been avoided by the programmer. As opposed to checked exceptions, runtime exceptions are ignored at the time of compilation.

Errors: These are not exceptions at all, but problems that arise beyond the control of the user or the programmer. Errors are typically ignored in your code because you can rarely do anything about an error. For example, if a stack overflow occurs, an error will arise. They are also ignored at the time of compilation.

Page 14: Suga java training_with_footer

Exception Handling

Page 15: Suga java training_with_footer

Access ModifierAccess Control Modifiers:

Java provides a number of access modifiers to set access levels for classes, variables, methods and constructors. The four access levels are:

Visible to the package, the default. No modifiers are needed. Visible to the class only (private). Visible to the world (public). Visible to the package and all subclasses (protected).

Non Access Modifiers: Java provides a number of non-access modifiers to achieve many other

functionality. The static modifier for creating class methods and variables The final modifier for finalizing the implementations of classes,

methods, and variables. The abstract modifier for creating abstract classes and methods. The synchronized and volatile modifiers, which are used for threads.

Page 16: Suga java training_with_footer

Methods and ConstructorThe important difference between constructors and methods is

that constructors create and initialize objects that don't exist yet, while methods perform operations on objects that already exist.

Constructors can't be called directly; they are called implicitly when the new keyword creates an object. Methods can be called directly on an object that has already been created with new.

The definitions of constructors and methods look similar in code. They can take parameters, they can have modifiers (e.g. public), and they have method bodies in braces.

Constructors must be named with the same name as the class name. They can't return anything, even void (the object itself is the implicit return).

Methods must be declared to return something, although it can be void.

Page 17: Suga java training_with_footer

Coding Standards Case Sensitivity - Java is case sensitive, which means

identifier Hello and 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 word's 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. 

Page 18: Suga java training_with_footer

JunitJUnit is a unit testing framework for the Java

programming language. JUnit has been important in the development of test-driven development, and is one of a family of unit testing frameworks collectively known as xUnit that originated with JUnit.

Page 19: Suga java training_with_footer

Junit

Page 20: Suga java training_with_footer

Thank You

SUGA Consulting ServicesSUGA = Success Unlimited Guaranteed [email protected]