Best Java Programming training in Nagpur - PowerPoint PPT Presentation

About This Presentation
Title:

Best Java Programming training in Nagpur

Description:

PSK Technologies is a training institute that provides best training on java course in Nagpur.In PSK Technologies,candidates will be getting industrial level of training on java. Core and advanced java Real time examples with each and every topic of the classes will be provided. To attend free demo classes, contact on 9970141466 else visit for complete details on java training center in Nagpur – PowerPoint PPT presentation

Number of Views:116

less

Transcript and Presenter's Notes

Title: Best Java Programming training in Nagpur


1
CORE JAVA
  • PSK TECHNOLOGIES
  • An ISO 90012015 (QMS) Certified IT Company
    Computer Education Software Development
    Computer Sales Services
  •  
  • Plot No-780, Near Durga Temple,
  • Katol Road Chaoni, Nagpur-13
  • Phone 9975288300 / 9970141466
  • Email info_at_psktechnologies.co.in
  • website www.pskitservices.com

2
  • CONTENT
  • Constructor
  • Static variable
  • This Keywords
  • Inheritance
  • Abstraction Interface

Website www.pskitservices.com Phone 9975288300
/ 9970141466
3
  • Constructor
  • A constructor is a special member function
    whose task is to initialize the objects of its
    class. It is special because its name is the same
    as the class name. The constructor is invoked
    whenever an object of its associated class is
    created. It is called constructor because it
    construct the values of data member of the class.

A constructor is declared and defined as
follows //class with a constructor Class
integer int m,n Public integer (void)
//constructor declared . . Integer
integer (void) //constructor defined m 0 n
0
Website www.pskitservices.com Phone 9975288300
/ 9970141466
4
  • When a class contains a constructor like the one
    defined above, it is guaranteed that an object
    created by the class will be initialized
    automatically. For example, the declaration
    Integer int1 // object int1 created.
  • Not only created the object int1 of the integer
    but also initializes its data members m and n to
    zero. There is no need to write any statement to
    invoke.
  • the constructor function (as we do with the
    normal member function). If a normal member
    function is defined for zero initialization, we
    would need to invoke this function for each of
    the objects separately. This would be very
    inconvenient, if there are a larger number of
    objects.
  • A constructor that accepts no parameters is
    called the default constructor. The default
    constructor for class A is AA (). If no such
    constructor is defined, then the compiler
    supplies a default constructor.

Website www.pskitservices.com Phone 9975288300
/ 9970141466
5
  • Program
  • class Student4
  • int id
  • String name Student4(int i,String n)
  • id i name n
  • void display()
  • System.out.println("Id"id"\t""Name"name)
  • public static void main(String args)
  • Student4 s1 new Student4(111,"Karan")
  • Student4 s2 new Student4(222,"Aryan")
  • s1.display()

Website www.pskitservices.com Phone 9975288300
/ 9970141466
6
  • Program
  • Constructor overloading
  • class Student5
  • int id
  • String name int age
  • Student5(int i,String n)
  • id i name n
  • Student5(int i,String n,int a)
  • id i name n agea
  • void display()
  • System.out.println(id" "name" "age)

Website www.pskitservices.com Phone 9975288300
/ 9970141466
7
  • Copy Constructor
  • Java Copy Constructor
  • There is no copy constructor in java. But, we can
    copy the values of one object to another like
    copy constructor in C.
  • There are many ways to copy the values of one
    object into another in java. They are
  • By constructor
  • By assigning the values of one object into
    another
  • By clone() method of Object class/

Website www.pskitservices.com Phone 9975288300
/ 9970141466
8
  • Program
  • class Student6
  • int id
  • String name Student6(int i,String n)
  • id i name n
  • Student6(Student6 s)
  • id s.id
  • name s.name
  • void display()
  • System.out.println(id" "name)

Website www.pskitservices.com Phone 9975288300
/ 9970141466
9
  • STATIC VARIABLE
  • Static Member Function
  • 1) Like static member variable we can also have
    static member function.
  • 2) A static function can have access to only
    other static member (function or variable)
    declared in same class.
  • 3) A static member function can be called using
    the class name. class_name function_name
  • When counter () function is called and gets
    destroyed each time when counter () function
    ends.But, if we makes it static, once
    initialized count will have a scope till the end
    of main () function and it will carry, its
    value through function calls too. If you dont
    initialized a static variable, they are by
    default initialized to zero.

Website www.pskitservices.com Phone 9975288300
/ 9970141466
10
  • Program
  • class Counter2
  • static int count //will get memory only once and
    retain its value
  • Counter2()
  • count
  • System.out.println(count)
  • /void display()
  • System.out.println("\n\n\n"count)
  • /
  • public static void main(String args)

Website www.pskitservices.com Phone 9975288300
/ 9970141466
11
  • Why Java Main Method Is Static?
  • Because object is not required to call static
    method if it were non-static method,
  • jvm create object first then call main() method
    that will lead the problem of extra memory
    allocation.
  • Java static block
  • Is used to initialize the static data member.
  • 2) It is executed before main method at the time
    of class loading
  • class A2
  • static
  • System.out.println("static block is invoked")
  • public static void main(String args)
  • System.out.println("Hello main")

Website www.pskitservices.com Phone 9975288300
/ 9970141466
12
  • THIS KEYWORD
  • Definition of This
  • To refer the current class instance variable to
    invoke the current class constructor to invoke
    the current class method to pass as an argument
    in the method call to pass as an argument in the
    constructor call to return the current class
    instance proving this keyword there can be a lot
    of usage of java this keyword. In java, this is a
    reference variable that refers to the current
    object.
  • Using this keyword
  • Here is given the 6 usage of java this keyword.
  • 1.this keyword can be used to refer current class
    instance variable.
  • 2.this() can be used to invoke current class
    constructor.
  • 3.this keyword can be used to invoke current
    class method (implicitly)
  • 4.this can be passed as an argument in the method
    call.
  • 5.this can be passed as argument in the
    constructor call.
  • 6.this keyword can also be used to return the
    current class instance

Website www.pskitservices.com Phone 9975288300
/ 9970141466
13
  • Program
  • class This1
  • int id
  • String name
  • This1(int id,String name)
  • this.id id
  • this.name name
  • void display()
  • System.out.println(id" "name)
  • public static void main(String args)
  • This1 s1 new This1(11,"Karan")

Website www.pskitservices.com Phone 9975288300
/ 9970141466
14
  • Constructor Call Using This
  • This() can be used to invoked current class
    constructor.
  • The this() constructor call can be used to invoke
    the current class constructor (constructor
    chaining).
  • This approach is better if you have many
    constructors in the class and want to reuse that
    constructor.
  • Program
  • class ThisCon
  • int id
  • String name
  • ThisCon()
  • System.out.println("default constructor
  • is invoked")
  • ThisCon(int id,String name)
  • this ()
  • //it is used to invoked current class
    constructor.
  • this.id id
  • this.name name
  • void display()

Website www.pskitservices.com Phone 9975288300
/ 9970141466
15
  • Program
  • This keyword refers to the current class instance
    variable.
  • In this program, we are printing the reference
    variable and this, output of both variables are
    same
  • class A5
  • void m()
  • System.out.println(this)//prints same reference
    ID
  • public static void main(String args)
  • A5 objnew A5()
  • //System.out.println(obj)
  • //prints the reference ID obj.
  • m()

Website www.pskitservices.com Phone 9975288300
/ 9970141466
16
  • Inheritance
  • Why multiple inheritance is not in java.
  • Program
  • class A
  • A()
  • System.out.println("A constructor called")
  • System.out.println("asd")
  • class B extends A
  • B()
  • System.out.println("B constructor called")

Website www.pskitservices.com Phone 9975288300
/ 9970141466
17
  • Program
  • class A
  • int a,b
  • void getA(int x,int y)
  • ax by
  • System.out.println("Super Add"(ab))
  • class B extends A
  • int m,n
  • void getB(int t,int s,int p,int q)
  • super.getA(t,s) mp
  • nq

Website www.pskitservices.com Phone 9975288300
/ 9970141466
18
  • Abstraction Interface
  • Abstract class in Java
  • A class that is declared with abstract keyword,
    is known as abstract class in java. It can have
    abstract and non-abstract methods (method with
    body).Before learning java abstract class, let's
    understand the abstraction in java first.
  • Abstraction in Java
  • Abstraction is a process of hiding the
    implementation details and showing only
    functionality to the user. Another way, it shows
    only important things to the user and hides the
    internal details for example sending sms, you
    just type the text and send the message. You
    don't know the internal processing about the
    message delivery. Abstraction lets you focus on
    what the object does instead of how it does it.
  • Ways to achieve Abstraction
  • There are two ways to achieve abstraction in java
  • Abstract class (0 to 100)
  • Interface (100)

Website www.pskitservices.com Phone 9975288300
/ 9970141466
19
  • Program
  • abstract class Bank
  • abstract int getRateOfInterest()
  • class SBI extends Bank
  • int getRateOfInterest()
  • return 7
  • class PNB extends Bank
  • int getRateOfInterest()
  • return 9

Website www.pskitservices.com Phone 9975288300
/ 9970141466
20
  • Interface With Class
  • An interface in java is a blueprint of a class.It
    has static constants and abstract methods only.
    The interface in java is a mechanism to achieve
    fully abstraction. There can be only abstract
    methods in the java interface not method body.
    It is used to achieve fully
    abstraction and multiple inheritance in Java.
  • Program
  • interface f1
  • public void get(int x,int y)
  • interface f2
  • public void show()
  • class Myclass implements f1,f2
  • int a,b
  • public void get(int x,int y)
  • ax by
  • public void show()

Website www.pskitservices.com Phone 9975288300
/ 9970141466
21
  • Program
  • import java.util.
  • interface f1
  • public void get()
  • final int c5
  • interface f2
  • public void show()
  • class Myclass implements f1,f2
  • int a,b
  • Scanner scnew Scanner(System.in)
  • public void get()
  • System.out.println("Enter a and b")

Website www.pskitservices.com Phone 9975288300
/ 9970141466
22
OUR SOFTWARE COURSES
Website www.pskitservices.com Phone 9975288300
/ 9970141466
23
OUR HARDWARE COURSES
MCITP
NETWORKING
HARDWARE
CCNA
LINUX
CCNP
Website www.pskitservices.com Phone 9975288300
/ 9970141466
24
OUR SERVICES
WEBSITE DESIGNING DEVELOPMENT
Website www.pskitservices.com Phone 9975288300
/ 9970141466
25
IT TRAINING
Website www.pskitservices.com Phone 9975288300
/ 9970141466
26
DIGITAL MARKETING
Website www.pskitservices.com Phone 9975288300
/ 9970141466
27
LAPTOP SALES AND SERVICES
Website www.pskitservices.com Phone 9975288300
/ 9970141466
28
Thank You!
PSK TECHNOLOGIES PVT. LTD. IT
COMPANY
FOLLOW US ON
Address Plot no-780, Near Durga Temple,
Katol Road Chhaoni, Nagpur-13
https/www.pskitservices.com
Contact 9975288300
Write a Comment
User Comments (0)
About PowerShow.com