Support Statistics
¥.00 ·
0times
Text Preview (First 20 pages)
Registered users can read the full content for free
Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.
Page
1
(This page has no text content)
Page
2
(This page has no text content)
Page
3
JAVA PROGRAMMING FOR KIDS AGES 12 - 18 Copyright © 2021 S Basu All rights reserved.
Page
4
Disclaimer : The information and materials presented here are for educational purposes only. Every effort has been made to make this book as complete and as accurate as possible but no warranty or fitness is implied. The information provided is on an "as is" basis. The ideas and opinions expressed are of the author's own imagination and the author is not affiliated to any organization, school or educational discipline and will not be held accountable or liable for any inadvertent misrepresentation.
Page
5
Contents Chapter 1 : Introduction What is Java? What is object oriented programming or OOP? What is JDK? What is JRE? What is JVM? JVM Architecture Chapter 2 : Java JDK and Eclipse IDE Installation 2.1: JDK download 2.2: Download and install Eclipse IDE Chapter 3 : Class, Object, Variables and Data types 3.1: What is a Java Class & Object? 3.2: What is Java Variable? 3.3: Java Data Types 3.4: What are access modifiers? 3.5: What is Java package? 3.6: Examples Example 1 Example 2 Chapter 4: Constructors & Methods 4.1: Constructor Example 4.2: Method Example 4.3: What is public static void main (String[ ] args)? 4.4: Mathematical Operators in Java Chapter 5: Conditional Statements & Loops 5.1: Conditional Statements Example 5.2: Loops 5.2.1: for loop Example
Page
6
5.2.2: while loop Example 5.3: Break statement Example Chapter 6: Array Example 1 Example 2 Chapter 7: Object Oriented Programming Concepts 7.1: Encapsulation Example 7.2: Inheritance Example 7.3: Polymorphism 7.3.1: Dynamic Polymorphism Example 7.3.2: Static Polymorphism Example TEST Answers
Page
7
Chapter 1 : Introduction Java is the most important programming language. If you have the full grasp of Java basics, then you can easily learn any object oriented programming language in this world. What is Java? Important points to note are: Java is an object oriented programming (OOP) language . Java is platform independent meaning that it can run on any machine containing JVM . In order to code and execute a Java code, JDK is needed. What is object oriented programming or OOP? Object oriented programming or OOP is all about working with classes , objects , methods and variables (explained in Chapter 3 ). The most important concepts of OOP are: Encapsulation , Inheritance and Polymorphism (explained in Chapter 7 ). What is JDK? JDK stands for Java Development Kit which is needed to code and execute Java . JDK includes both JVM and JRE.
Page
8
What is JRE? JRE stands for Java Runtime Environment . JRE contains classes , libraries and software that a Java program needs in order to run successfully. JRE also contains JVM . What is JVM? JVM stands for Java virtual machine . JVM is responsible for converting the byte code present in .class file into machine depended code which is understood by that specific processor or operating system or machine. JVM Architecture Java files are saved with a .java extension. When we compile the .java file, .class file is generated and this .class file contains byte
Page
9
code. JVM handles the .class file and generates the desired output of the Java program. What does compilation mean in Java? Java compilation is the process of converting a .java file (which contains readable text Java code) into a .class file (which contains byte code). What is byte code? Byte codes are sequence of 0s and 1s. Let’s look into JVM Architecture . JVM architecture is divided into three main sections: 1. Class Loader 2. JVM Memory 3. Execution Engine
Page
10
Class Loader It is responsible for loading the .class file to the JVM memory . JVM Memory It is further divided into: Method area – It stores all the methods information. (methods explained in chapter 4 ). Heap area – It stores all the objects and its corresponding instance variables (objects and variables explained in chapter 3 ). Stack Area – It stores all the local variables and the results of the methods (local variables explained in chapter 3 ).
Page
11
PC Register – PC register store the address of the currently executing Java virtual machine instruction. Native Method Stacks - Native method stacks contains native codes which are written in another language instead of Java . Execution Engine It is further divided into: Interpreter – It converts the byte code to machine dependent code which is understood by the machine and desired output is generated. JIT Compiler – JIT stands for Just in Time compiler and its main task is to increases the performance and efficiency of Interpreter . Now let’s summarize the Java program execution process
Page
12
Before we start coding, we need to download and install JDK and an IDE . What is Java IDE? IDE stands for Integrated Development Environment . It is a software application needed to write programs in Java.
Page
13
There are multiple IDE present but we will be using Eclipse IDE to write our Java code.
Page
14
Chapter 2 : Java JDK and Eclipse IDE Installation 2.1: JDK download Open Google chrome browser (or any browser you like ) and search for java jdk download and select the oracle website highlighted in the screen shot below. Download the latest JDK version.
Page
15
Select your operating system. (since I am using windows, so downloading windows-x64 installer highlighted in the screen shot below ) Check on review box, click download and install.
Page
16
(This page has no text content)
Page
17
Click close. Now check whether the Java PATH is automatically added to your Environment Variables or not. What is Java PATH? Java PATH is an environment variable which helps us to locate the JDK bin directory or folder which contains all the important files needed to execute a Java program. Let’s access the Environment Variables. ➢ Open control panel -> click on System and Security .
Page
18
➢ Click on System ➢ Click on Advanced system settings.
Page
19
➢ Click on Environment Variables.
Page
20
➢ Under System variables , select Path -> click Edit ➢ Javapath shows highlighted in the screen shot below. ➢ Click ok and exit. We have successfully installed JDK in our machine. Now let’s download and install Eclipse IDE.
Comments 0
Loading comments...
Reply to Comment
Edit Comment