1 / 43

PROGRAMMING IN JAVA

PROGRAMMING IN JAVA. Presented By: Aparchyanta Aneja. CONTENTS. PROGRAMMING LANGUAGE. What is a programming language???. Programming Language is used for communication between a machine and human. Programming Language. Instruction. Output. Machine. Software Developement.

duard
Download Presentation

PROGRAMMING IN JAVA

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. PROGRAMMING IN JAVA Presented By: AparchyantaAneja

  2. CONTENTS

  3. PROGRAMMING LANGUAGE What is a programming language??? Programming Language is used for communication between a machine and human.

  4. Programming Language Instruction Output Machine Software Developement

  5. HISTORY OF JAVA WORA Write Once Run Anywhere Platform Independent Portable

  6. FEATURES OF JAVA PIE : Polymorphism, Inheritance, Encapsulation

  7. .java .class Java Compiler Interpreter/ JVM Write Compile Execute

  8. API are the libraries that we will be using to create java Program. COMPONENTS OF JAVA Takes the instruction, executes it and give the result. Java Application JVM (Java Virtual Machine) API (Application Programming Interface) Java Platform OS

  9. JAVA DEVEPOLMENT KIT C/C++ Java

  10. DOWNLOADING INSTALLING & CONFIGURING JAVA

  11. EXAMPLE OF JAVA

  12. No need of creating the object of the class Program to print Hello World Access Specifier No return value Name of the class class HelloWorld { public static void main(String alpha[]) { System.out.println("Hello World!!!"); } } Keyword Inbuilt Class Array Variable Name Entry point Keywords Final class Method overloaded to print message Output stream

  13. OOPS FEATURES

  14. DATATYPE Name Contact Age Email Eat Walk Talk Person

  15. CLASSES & OBJECTS obj • Class is a blue print of an object • Object is an instance (memory) of a class. class Emp{ String name, contact; } class CEmp{ public static void main(String alpha[]) { Empobj=new Emp(); obj.name=“John"; obj.contact=“443-123-4567"; System.out.println(obj.name); System.out.println(obj.contact); } } Name Aman Contact 9023753113 1001 Object Heap Memory Object Reference Fetch the value through heap memory

  16. CONSTRUCTOR • Used to initialize the instance members of class with their respective default values according to the data type. • Name of the constructor should be the same as that of the class • No return value • Does not initialize local variable • Automatically called when the object of the class is created Default Constructor Parameterized Constructor

  17. INHERITANCE Deriving a new class from a given base class. rotate() { } playsound() { } Square rotate() { } playsound() { } Circle rotate() { } playsound() { } Triangle

  18. rotate() playsound() Shape Super Class Sub classes Square Circle Triangle

  19. ENCAPSULATION Protective barrier that prevents the code and data being randomly accessed by other code defined outside the class.

  20. Package 1 Package 2 Public : Protected : Default : Private : Class C1 Class C4 Class C5 Class C2 Class C3 C1, C2, C3, C4, C5 C1, C2, C3, C4 C1, C2, C3 C1

  21. POLYMORPHISM Polymorphism is the ability of an object to take on many forms. Many Forms

  22. INTERFACE & ABSTRACT CLASSES Name Value Int a = 10; C1 obj=new C1(); Type User Defined Inbuilt Concrete Class Abstract Class Interface

  23. Full Implementation of Methods Partial Implementation of Methods It is inherited. No implementation of Methods It is implemented Concrete Class Abstract Class Interface void display() Declaration { } Definition

  24. abstract class Calc{ int add(int a, int b) { return a+b; } abstract int multi(int a, int b); } class Ccal extends Calc{ int multi(int a, int b) { return a*b; } } class CalMain{ psvm(String alpha[]){ Ccalobj=new Ccal(); S.o.p(“Sum:”+obj.add(10,20)); S.o.p(“Sum:”+obj.multi(10,20)); } interface Calc{ int add(int a, int b); int multi(int a, int b); } class Ccal implements Calc{ public int add(int a, int b) { return a+b; } public int multi(int a, int b) { return a*b; } } class CalMain{ psvm(String alpha[]){ Ccalobj=new Ccal(); S.o.p(“Sum:”+obj.add(10,20)); S.o.p(“Sum:”+obj.multi(10,20)); } Interface Abstract Class

  25. QUESTIONS???

More Related