Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
11 views
Java Notes
Java basic questions and answers
Uploaded by
Muskan shaikh
AI-enhanced title
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save Java notes For Later
Download
Save
Save Java notes For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
11 views
Java Notes
Java basic questions and answers
Uploaded by
Muskan shaikh
AI-enhanced title
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save Java notes For Later
Carousel Previous
Carousel Next
Save
Save Java notes For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 9
Search
Fullscreen
Java programming What is Java? Java is a programming language and a platform. Java is a high \evel, robust, object-oriented and secure programming language. Java was developed by Sun Microsystems (which is now the subsidiary of Oracle) in the year 1995. James Gosling is known as the father of Java. Platform: Any hardware or software environment in which a program runs, is known as a platform. Since Java has a runtime environment (JRE) and API, it is called a platform. Application 1. Desktop Applications such as acrobat reader, media player, antivirus, etc. . Web Applications such as irctc.co.in, javatpoint.com, etc. . Enterprise Applications such as banking applications. . Mobile . Embedded System . Smart Card . Robotics . Games, etc. ONONRWN Features of Java Simple Java is very easy to learn, and its syntax is simple, clean and easy to understand. According to Sun Microsystem, Java language is a simple programming language because: Java syntax is based on C++ (so easier for programmers to learn it aftero Java has removed many complicated and rarely-used featu 2/10 example, explicit pointers, operator overloading, etc. ‘ea There is no need to remove unreferenced objects because there is an Automatic Garbage Collection in Java. Object-oriented Java is an object-oriented programming language. Everything in Java is an object. Object-oriented means we organize our software as a combination of different types of objects that incorporate both data and behaviour. Platform Independent Class File “| Mac/OS windows Linux JvM VM IV 1 J df oth Java is platform independent because it is different from other languages like C, C++, etc. which are compiled into platform specific machines while Java is a write once, run anywhere language. A platform is the hardware or software environment in which a program runs. Secured Java is best known for its security. With Java, we can develop virus-free systems. Java is secured because: o No explicit pointer « Java Programs run inside a virtual machine sandbox Robust The English mining of Robust is strong. Java is robust because:o Ituses strong memory management. o There is a lack of pointers that avoids security problems. «Java provides automatic garbage collection which runs on the Java Virtual Machine to get rid of objects which are not being used by a Java application anymore. Architecture-natural Java is architecture natural because there are no implementation dependent features, for example, the size of primitive types is fixed. Portable Java is portable because it facilitates you to carry the Java bytecode to any platform. It doesn’t require any implementation. High-performance Java is faster than other traditional interpreted programming languages because Java bytecode is "close" to native code. Distributed Java is distributed because it facilitates users to create distributed applications in Java. Multi-threaded A thread is like a separate program, executing concurrently. We can write Java programs that deal with many tasks at once by defining multiple threads. Dynamic Java is a dynamic language. It supports the dynamic loading of classes. It means classes are loaded on demand. It also supports functions from its native languages, i.e., C and C++.First Java Program @ class keyword is used to declare a class in Java. public keyword is an access modifier that represents visibility. It means it is visible to all. static is a keyword. If we declare any method as static, it is known as the static method. The core advantage of the static method is that there is no need to create an object to invoke the static method. The main() method is executed by the JVM, so it doesn't require creating an object to invoke the main() method. So, it saves memory. void is the return type of the method. It means it doesn't return any value. o main represents the starting point of the program. o String[] args or String args[] is used for command line argument. > $ystem.out.printin() is used to print statement. Here, System is a class, out is an object of the PrintStream class, println() is a method of the PrintStream class. What happens at runtime? At runtime, the following steps are performed: C2 ees a Qa &)Q) Can you save a Java source file by another name than the class name? Yes, if the class is not Public. It is explained in the figure given below: case simple} eubtestatic void main(seang argst I} compiles System out pani Helo"): —* ertecode » ard ji: smple.aes Q) Can you have multiple classes in a java source file? Yes, like the figure given below illustrates: e- - &> - * = Djava Difference between JDK, JRE, and JVM JVM JVM (Java Virtual Machine) is an abstract machine. It is called a virtual machine because it doesn't physically exist. It is a specification that provides a runtime environmentJRE 10 JRE is an acronym for Java Runtime Environment. It is also written a a RTE. The Java Runtime Environment is a set of software tools which are used for developing Java applications. It is used to provide the runtime environment. JDK JDK is an acronym for Java Development Kit. The Java Development Kit (JDK) is a software development environment which is used to develop Java applications and applets. It physically exists. It contains JRE + development tools. Java Variables A variable is a container which holds the value while the Java program is executed. A variable is assigned with a data type. Variable is a name of memory location. There are three types of variables in java: local, instance and static. 1) Local Variable A variable declared inside the body of the method is called local variable. You can use this variable only within that method and the other methods in the class aren't even aware that the variable exists. A local variable cannot be defined with "static" keyword. 2) Instance Variable A variable declared inside the class but outside the body of the method, is called an instance variable. It is not declared as static. 3) Static variable A variable that is declared as static is called a static variable. It cannot be local. You can create a single copy of the static variable and share it among all the instances of the class.Data Types in Java @ id in the Data types specify the different sizes and values that can be store variable. There are two types of data types in Java: 1, Primitive data types: The primitive data types include boolean, char, byte, short, int, long, float and double. 2. Non-primitive data types: The non-primitive data types include Classes, Interfaces, and Arrays. Unicode System Unicode is a universal international standard character encoding that is capable of representing most of the world's written languages. Why java uses Unicode System? Before Unicode, there were many language standards: © ASCII (American Standard Code for Information Interchange) for the United States. > ISO 8859-1 for Western European Language. o KOI-8 for Russian. >» GB18030 and BIG-5 for Chinese, and so on. Problem This caused two problems: 1. A particular code value corresponds to different letters in the various language standards. 2. The encodings for languages with large character sets have variable lengtt 3. Some common characters are encoded as single bytes, other require two or more byte.Solution To solve these problems, a new language standard was developed i.e! 8/10 System. In unicode, character holds 2 byte, so java also uses 2 byte for characters. lowest value:\u0000 highest value:\UFFFF Operators in Java Operator in Javais a symbol that is used to perform operations. For example: +, -, *,/ etc. There are many types of operators in Java which are given below: © Unary Operator, o Arithmetic Operator, o Shift Operator, © Relational Operator, o Bitwise Operator, e Logical Operator, Ternary Operator and o Assignment Operator. Java Keywords Java keywords are also known as reserved words. Keywords are particular words that act as a key to a code. These are predefined words by Java so they cannot be used as a variable or object name or class name.Java Control Statements | Control Flow in Java provides three types of control flow statements. 1. Decision Making statements o tf statements o switch statement 2. Loop statements o do while loop o while loop o for loop for-each loop 3. Jump statements © break statement e continue statement Decision-Making statements: As the name suggests, decision-making statements decide which statement to execute and when. 1) If Statement: In Java, the "if” statement is used to evaluate a condition. The control of the program is diverted depending upon the specific condition. The condition of the If statement gives a Boolean value, either true or false. 2) if-else statement The if-else statement is an extension to the if-statement, which uses another block of code, i.e., else block. 3) if-else-if ladder: if-statement followed by multiple else- The if-else-if statement contains the e can say that it is the chain of if-else if statements. In other words, we
You might also like
Java Notes
PDF
No ratings yet
Java Notes
23 pages
Java Premium Notes
PDF
No ratings yet
Java Premium Notes
80 pages
Core Java Note
PDF
No ratings yet
Core Java Note
79 pages
Coding a to z
PDF
No ratings yet
Coding a to z
53 pages
Introduction To Java
PDF
No ratings yet
Introduction To Java
15 pages
Java UNIT 1
PDF
No ratings yet
Java UNIT 1
58 pages
UNIT 1.1 Java Fundamentals
PDF
No ratings yet
UNIT 1.1 Java Fundamentals
41 pages
core java
PDF
No ratings yet
core java
163 pages
Core Java Notes
PDF
No ratings yet
Core Java Notes
136 pages
Module 2
PDF
No ratings yet
Module 2
101 pages
Java Unit-1 Notes
PDF
No ratings yet
Java Unit-1 Notes
19 pages
Presentation 1
PDF
No ratings yet
Presentation 1
26 pages
Notes Unit 1
PDF
No ratings yet
Notes Unit 1
9 pages
DAY 1 TECH
PDF
No ratings yet
DAY 1 TECH
37 pages
JAVA VIVA ??
PDF
No ratings yet
JAVA VIVA ??
74 pages
Notesjavadocx__2024_11_26_22_44_32
PDF
No ratings yet
Notesjavadocx__2024_11_26_22_44_32
61 pages
D1.1 What Makes Java More Powerful Than C and C++?
PDF
No ratings yet
D1.1 What Makes Java More Powerful Than C and C++?
16 pages
Core Java
PDF
No ratings yet
Core Java
77 pages
Java I
PDF
No ratings yet
Java I
47 pages
Java Unit 1
PDF
No ratings yet
Java Unit 1
56 pages
Java Module I and II
PDF
No ratings yet
Java Module I and II
31 pages
Software Engineer - Learn Java by Examples (2019)
PDF
No ratings yet
Software Engineer - Learn Java by Examples (2019)
69 pages
1 Introduction To Java
PDF
No ratings yet
1 Introduction To Java
25 pages
JavaUnit 1
PDF
No ratings yet
JavaUnit 1
24 pages
Unit - 1 Object Oriented Programming Through Java (B.Tech II-I)
PDF
No ratings yet
Unit - 1 Object Oriented Programming Through Java (B.Tech II-I)
10 pages
Vbspu Bca Java Note
PDF
No ratings yet
Vbspu Bca Java Note
203 pages
Java NOTES PDF
PDF
No ratings yet
Java NOTES PDF
33 pages
An Introduction To Core Java Unit-1
PDF
No ratings yet
An Introduction To Core Java Unit-1
97 pages
Java-class-1-compressed (1)
PDF
No ratings yet
Java-class-1-compressed (1)
14 pages
Lecture Notes Unit 1 Java
PDF
No ratings yet
Lecture Notes Unit 1 Java
37 pages
Java Porgramming Part 1
PDF
No ratings yet
Java Porgramming Part 1
37 pages
JAVA
PDF
No ratings yet
JAVA
34 pages
Java Notebook
PDF
100% (1)
Java Notebook
76 pages
DishuNotes
PDF
No ratings yet
DishuNotes
68 pages
Java Project
PDF
No ratings yet
Java Project
35 pages
175 16sccit4-16sccca3-16scccs3 2020051602435211 PDF
PDF
No ratings yet
175 16sccit4-16sccca3-16scccs3 2020051602435211 PDF
126 pages
Java Unit 1
PDF
No ratings yet
Java Unit 1
65 pages
CS-22
PDF
No ratings yet
CS-22
42 pages
LectureNotesdocx__2024_11_22_16_12_13docx__2024_11_25_15_01_08
PDF
No ratings yet
LectureNotesdocx__2024_11_22_16_12_13docx__2024_11_25_15_01_08
27 pages
Chapter 1. Introduction To Java
PDF
No ratings yet
Chapter 1. Introduction To Java
20 pages
Java First Unit
PDF
No ratings yet
Java First Unit
42 pages
Java Notes
PDF
No ratings yet
Java Notes
120 pages
JAVA1
PDF
No ratings yet
JAVA1
42 pages
Java 1 Intro, Variable Datetype Oper
PDF
No ratings yet
Java 1 Intro, Variable Datetype Oper
22 pages
Unit 1 Introduction to Java notes Jan 2025
PDF
No ratings yet
Unit 1 Introduction to Java notes Jan 2025
45 pages
Introduction To Java Language: Saravana Kumar
PDF
No ratings yet
Introduction To Java Language: Saravana Kumar
48 pages
What Is Java?: Platform: Any Hardware or Software
PDF
No ratings yet
What Is Java?: Platform: Any Hardware or Software
46 pages
Java Notes
PDF
No ratings yet
Java Notes
391 pages
Unit1
PDF
No ratings yet
Unit1
14 pages
What Is Java
PDF
No ratings yet
What Is Java
15 pages
Java Notes Unit2
PDF
No ratings yet
Java Notes Unit2
29 pages
Javaenture Workshop Finaldraft.pptx
PDF
No ratings yet
Javaenture Workshop Finaldraft.pptx
181 pages
Java 1 Unit
PDF
No ratings yet
Java 1 Unit
45 pages
Wepik Unraveling The Wonders of Java A Comprehensive Guide 20231106101829jKUr
PDF
No ratings yet
Wepik Unraveling The Wonders of Java A Comprehensive Guide 20231106101829jKUr
106 pages
KCA 202 OOP Unit 1 - 240429 - 111726
PDF
No ratings yet
KCA 202 OOP Unit 1 - 240429 - 111726
24 pages
Java
PDF
No ratings yet
Java
21 pages
Core Java Cheat Sheet
PDF
No ratings yet
Core Java Cheat Sheet
11 pages
Unit 1-Java Final
PDF
No ratings yet
Unit 1-Java Final
100 pages
Related titles
Click to expand Related Titles
Carousel Previous
Carousel Next
Java Notes
PDF
Java Notes
Java Premium Notes
PDF
Java Premium Notes
Core Java Note
PDF
Core Java Note
Coding a to z
PDF
Coding a to z
Introduction To Java
PDF
Introduction To Java
Java UNIT 1
PDF
Java UNIT 1
UNIT 1.1 Java Fundamentals
PDF
UNIT 1.1 Java Fundamentals
core java
PDF
core java
Core Java Notes
PDF
Core Java Notes
Module 2
PDF
Module 2
Java Unit-1 Notes
PDF
Java Unit-1 Notes
Presentation 1
PDF
Presentation 1
Notes Unit 1
PDF
Notes Unit 1
DAY 1 TECH
PDF
DAY 1 TECH
JAVA VIVA ??
PDF
JAVA VIVA ??
Notesjavadocx__2024_11_26_22_44_32
PDF
Notesjavadocx__2024_11_26_22_44_32
D1.1 What Makes Java More Powerful Than C and C++?
PDF
D1.1 What Makes Java More Powerful Than C and C++?
Core Java
PDF
Core Java
Java I
PDF
Java I
Java Unit 1
PDF
Java Unit 1
Java Module I and II
PDF
Java Module I and II
Software Engineer - Learn Java by Examples (2019)
PDF
Software Engineer - Learn Java by Examples (2019)
1 Introduction To Java
PDF
1 Introduction To Java
JavaUnit 1
PDF
JavaUnit 1
Unit - 1 Object Oriented Programming Through Java (B.Tech II-I)
PDF
Unit - 1 Object Oriented Programming Through Java (B.Tech II-I)
Vbspu Bca Java Note
PDF
Vbspu Bca Java Note
Java NOTES PDF
PDF
Java NOTES PDF
An Introduction To Core Java Unit-1
PDF
An Introduction To Core Java Unit-1
Java-class-1-compressed (1)
PDF
Java-class-1-compressed (1)
Lecture Notes Unit 1 Java
PDF
Lecture Notes Unit 1 Java
Java Porgramming Part 1
PDF
Java Porgramming Part 1
JAVA
PDF
JAVA
Java Notebook
PDF
Java Notebook
DishuNotes
PDF
DishuNotes
Java Project
PDF
Java Project
175 16sccit4-16sccca3-16scccs3 2020051602435211 PDF
PDF
175 16sccit4-16sccca3-16scccs3 2020051602435211 PDF
Java Unit 1
PDF
Java Unit 1
CS-22
PDF
CS-22
LectureNotesdocx__2024_11_22_16_12_13docx__2024_11_25_15_01_08
PDF
LectureNotesdocx__2024_11_22_16_12_13docx__2024_11_25_15_01_08
Chapter 1. Introduction To Java
PDF
Chapter 1. Introduction To Java
Java First Unit
PDF
Java First Unit
Java Notes
PDF
Java Notes
JAVA1
PDF
JAVA1
Java 1 Intro, Variable Datetype Oper
PDF
Java 1 Intro, Variable Datetype Oper
Unit 1 Introduction to Java notes Jan 2025
PDF
Unit 1 Introduction to Java notes Jan 2025
Introduction To Java Language: Saravana Kumar
PDF
Introduction To Java Language: Saravana Kumar
What Is Java?: Platform: Any Hardware or Software
PDF
What Is Java?: Platform: Any Hardware or Software
Java Notes
PDF
Java Notes
Unit1
PDF
Unit1
What Is Java
PDF
What Is Java
Java Notes Unit2
PDF
Java Notes Unit2
Javaenture Workshop Finaldraft.pptx
PDF
Javaenture Workshop Finaldraft.pptx
Java 1 Unit
PDF
Java 1 Unit
Wepik Unraveling The Wonders of Java A Comprehensive Guide 20231106101829jKUr
PDF
Wepik Unraveling The Wonders of Java A Comprehensive Guide 20231106101829jKUr
KCA 202 OOP Unit 1 - 240429 - 111726
PDF
KCA 202 OOP Unit 1 - 240429 - 111726
Java
PDF
Java
Core Java Cheat Sheet
PDF
Core Java Cheat Sheet
Unit 1-Java Final
PDF
Unit 1-Java Final