SlideShare a Scribd company logo
Static Loading- RAM Execution may or may not(C )
Dynamic Loading- ram only when execution (Java)
Main Method- code and MAIN method deleted form RAM-
Issue with structured programming language:
Global variables- open access-unsecured
Actual issue-
Project written by one coder- upgradation required- new coder takes lot of
time to read and upgrade- new coder may mess the original code as global
variables are there
Solution-Encapsulation
Structured programming language: 20 global variables-only 5 used, but 15
unused are still available to everyone for change- no way to restrict these
variables
JAVA: THE VARAIBLES AND FUNCTIONS ARE ENCLOSED IN A BLOCK –CLASS
VARIABLES INSIDE THE CLASS ARE NOT GLOBAL (instance variables)
Encapsulation is the process of binding data along with it corresponding
functionalities. It provides security to data present inside the program.
Backbone of OOPS- everything is encapsulated-nothing outside class
C++ not OOP AS MAIN METHOD declared outside class.
public class HelloWorld
{
public static void main(String[] args)
{
System.out.println("HELLO
WORLD!");
}
}
Class name- HelloWorld
Only one method- main
Rule- No method or function without return
datatype
For main()- return type- void
Public-
Static-
Stirng-another class
We save the file as HelloWorld.java
After execution (compiler) HelloWorld,class
file created(bytecode)
X=x+1 gives error
Main method loaded to ram but
x still in hard drive-any
procedure to load it to RAM-
Procedure to load content of
Hard disk to RAM dynamically
at runtime- creating an object
(this is the need for crating an
object)
new keyword:
A a1= new A();- creation of object of class A
New operator transfers content of .class file from hard disk to RAM.
JVM encounters new keyword- understands it has to load all non static elements of .class file from
harddisk to RAM
Inside RAM- space allocated for non static elements- address of this memory location assigned to
variable a, where variable a is of type class A.
Object- the memory in the RAM which is reserved for non static elements of .class file.
Object-instance of class
a is known as handler or pointer of type A.
Strictly speaking a is reference of an object (pointing finger)
Garbage collector
JVM follows concept of dynamic loading- signature is loaded
If there are n classes in a .java file JVM creates n .class file
Cases-if there are 1>x>n main methods inside n classes
Main method loads-
Object created and address assigned to O1
Variable x1 ceated assigned value- 10
x1 value changed to 25
Another object of obj6 created- address assigned to O1 again
Previous address of O1 overwritten-it now point to new object
Obj6 O2=O1- object O2 created and O1 ‘s value assigned to it
We have two references O1 and O2 to same object
JVM workflow
Loading non static variables
Initialising uninitialized variables
with their default values
• Ways of creating object
1. Hello a=new Hello()
2. new Hello()
3. Hello a; (Page 38-40)
• Static Keyword

More Related Content

PPTX
PPTX
DOCX
java tr.docx
DOCX
PDF
Java training materials for computer engineering.pdf
PPTX
Object oriented programming in java
PDF
Java Interview Questions Answers Guide
PPTX
Class and Object.pptx from nit patna ece department
java tr.docx
Java training materials for computer engineering.pdf
Object oriented programming in java
Java Interview Questions Answers Guide
Class and Object.pptx from nit patna ece department

Similar to Java Core.pptx (20)

PPTX
PPTX
oop unit1.pptx
PPTX
1 java fundamental KSHRD
PPTX
DAY_1.1.pptx
PPT
Java findamentals1
PPT
Java findamentals1
PPT
Java findamentals1
PDF
Class and Object JAVA PROGRAMMING LANG .pdf
PPTX
Java basics
PPTX
Introduction to oop and java fundamentals
PPTX
PPT
JavaTutorials.ppt
PPTX
UNIT I OOP AND JAVA FUNDAMENTALS CONSTRUCTOR
PPTX
Lecture 5.pptx
PPT
Intro Java Rev010
PPT
Classes and Objects
DOCX
Java notes
PPT
Java OOP s concepts and buzzwords
oop unit1.pptx
1 java fundamental KSHRD
DAY_1.1.pptx
Java findamentals1
Java findamentals1
Java findamentals1
Class and Object JAVA PROGRAMMING LANG .pdf
Java basics
Introduction to oop and java fundamentals
JavaTutorials.ppt
UNIT I OOP AND JAVA FUNDAMENTALS CONSTRUCTOR
Lecture 5.pptx
Intro Java Rev010
Classes and Objects
Java notes
Java OOP s concepts and buzzwords
Ad

Recently uploaded (20)

PDF
Artificial Superintelligence (ASI) Alliance Vision Paper.pdf
PPT
Total quality management ppt for engineering students
PDF
Influence of Green Infrastructure on Residents’ Endorsement of the New Ecolog...
PPTX
Management Information system : MIS-e-Business Systems.pptx
PDF
A SYSTEMATIC REVIEW OF APPLICATIONS IN FRAUD DETECTION
PDF
UNIT no 1 INTRODUCTION TO DBMS NOTES.pdf
PDF
PREDICTION OF DIABETES FROM ELECTRONIC HEALTH RECORDS
PDF
Unit I ESSENTIAL OF DIGITAL MARKETING.pdf
PDF
Accra-Kumasi Expressway - Prefeasibility Report Volume 1 of 7.11.2018.pdf
PDF
737-MAX_SRG.pdf student reference guides
PPTX
Current and future trends in Computer Vision.pptx
PDF
Categorization of Factors Affecting Classification Algorithms Selection
PPTX
Feature types and data preprocessing steps
PDF
22EC502-MICROCONTROLLER AND INTERFACING-8051 MICROCONTROLLER.pdf
PPTX
communication and presentation skills 01
PPTX
Module 8- Technological and Communication Skills.pptx
PPTX
Sorting and Hashing in Data Structures with Algorithms, Techniques, Implement...
PPTX
Artificial Intelligence
PDF
BIO-INSPIRED ARCHITECTURE FOR PARSIMONIOUS CONVERSATIONAL INTELLIGENCE : THE ...
PPTX
6ME3A-Unit-II-Sensors and Actuators_Handouts.pptx
Artificial Superintelligence (ASI) Alliance Vision Paper.pdf
Total quality management ppt for engineering students
Influence of Green Infrastructure on Residents’ Endorsement of the New Ecolog...
Management Information system : MIS-e-Business Systems.pptx
A SYSTEMATIC REVIEW OF APPLICATIONS IN FRAUD DETECTION
UNIT no 1 INTRODUCTION TO DBMS NOTES.pdf
PREDICTION OF DIABETES FROM ELECTRONIC HEALTH RECORDS
Unit I ESSENTIAL OF DIGITAL MARKETING.pdf
Accra-Kumasi Expressway - Prefeasibility Report Volume 1 of 7.11.2018.pdf
737-MAX_SRG.pdf student reference guides
Current and future trends in Computer Vision.pptx
Categorization of Factors Affecting Classification Algorithms Selection
Feature types and data preprocessing steps
22EC502-MICROCONTROLLER AND INTERFACING-8051 MICROCONTROLLER.pdf
communication and presentation skills 01
Module 8- Technological and Communication Skills.pptx
Sorting and Hashing in Data Structures with Algorithms, Techniques, Implement...
Artificial Intelligence
BIO-INSPIRED ARCHITECTURE FOR PARSIMONIOUS CONVERSATIONAL INTELLIGENCE : THE ...
6ME3A-Unit-II-Sensors and Actuators_Handouts.pptx
Ad

Java Core.pptx

  • 1. Static Loading- RAM Execution may or may not(C ) Dynamic Loading- ram only when execution (Java) Main Method- code and MAIN method deleted form RAM- Issue with structured programming language: Global variables- open access-unsecured Actual issue- Project written by one coder- upgradation required- new coder takes lot of time to read and upgrade- new coder may mess the original code as global variables are there Solution-Encapsulation Structured programming language: 20 global variables-only 5 used, but 15 unused are still available to everyone for change- no way to restrict these variables JAVA: THE VARAIBLES AND FUNCTIONS ARE ENCLOSED IN A BLOCK –CLASS VARIABLES INSIDE THE CLASS ARE NOT GLOBAL (instance variables) Encapsulation is the process of binding data along with it corresponding functionalities. It provides security to data present inside the program. Backbone of OOPS- everything is encapsulated-nothing outside class C++ not OOP AS MAIN METHOD declared outside class.
  • 2. public class HelloWorld { public static void main(String[] args) { System.out.println("HELLO WORLD!"); } } Class name- HelloWorld Only one method- main Rule- No method or function without return datatype For main()- return type- void Public- Static- Stirng-another class We save the file as HelloWorld.java After execution (compiler) HelloWorld,class file created(bytecode) X=x+1 gives error Main method loaded to ram but x still in hard drive-any procedure to load it to RAM- Procedure to load content of Hard disk to RAM dynamically at runtime- creating an object (this is the need for crating an object)
  • 3. new keyword: A a1= new A();- creation of object of class A New operator transfers content of .class file from hard disk to RAM. JVM encounters new keyword- understands it has to load all non static elements of .class file from harddisk to RAM Inside RAM- space allocated for non static elements- address of this memory location assigned to variable a, where variable a is of type class A. Object- the memory in the RAM which is reserved for non static elements of .class file. Object-instance of class a is known as handler or pointer of type A. Strictly speaking a is reference of an object (pointing finger) Garbage collector JVM follows concept of dynamic loading- signature is loaded
  • 4. If there are n classes in a .java file JVM creates n .class file Cases-if there are 1>x>n main methods inside n classes Main method loads- Object created and address assigned to O1 Variable x1 ceated assigned value- 10 x1 value changed to 25 Another object of obj6 created- address assigned to O1 again Previous address of O1 overwritten-it now point to new object Obj6 O2=O1- object O2 created and O1 ‘s value assigned to it We have two references O1 and O2 to same object
  • 5. JVM workflow Loading non static variables Initialising uninitialized variables with their default values
  • 6. • Ways of creating object 1. Hello a=new Hello() 2. new Hello() 3. Hello a; (Page 38-40)