KEMBAR78
JAVA Unit 2.1 | PDF | Java (Programming Language) | Java Virtual Machine
0% found this document useful (0 votes)
20 views1 page

JAVA Unit 2.1

Java is a high-level, object-oriented programming language known for its Write Once, Run Anywhere capability, allowing applications to run on any device supporting the Java Virtual Machine (JVM). Key features include multithreading support, a rich API, platform independence, and robust security measures. The JVM serves as an intermediary between Java code and the operating system, providing a runtime environment, memory management, and optimization for improved performance.

Uploaded by

dahiyavipin802
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views1 page

JAVA Unit 2.1

Java is a high-level, object-oriented programming language known for its Write Once, Run Anywhere capability, allowing applications to run on any device supporting the Java Virtual Machine (JVM). Key features include multithreading support, a rich API, platform independence, and robust security measures. The JVM serves as an intermediary between Java code and the operating system, providing a runtime environment, memory management, and optimization for improved performance.

Uploaded by

dahiyavipin802
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

JAVA: Java is a high-level, object-oriented programming language used to  Multithreading:Java's built-in support for multithreading allows for parallel

allows for parallel 10. Monitoring and Profiling: JVM provides tools for monitoring and profiling
build applications across platforms—from web and mobile apps to enterprise execution of multiple program parts, improving performance and responsiveness. Java applications, enabling developers to analyze performance metrics, memory
software. It is known for its Write Once, Run Anywhere capability, meaning  Rich API:Java's extensive API library provides a wide range of pre-built classes usage, and thread behavior.
code written in Java can run on any device that supports the Java Virtual
and methods for various tasks, simplifying development.
Machine (JVM).??Java is a popular high-level,object oriented 11. Dynamic Class Loading: JVM supports dynamic class loading, allowing
programing language that was originally developed by Sun Microsystems and classes to be loaded at runtime based on program requirements, enhancing
released in 1995. Currently, Java is owned by Oracle, and more than 3 billion Java virtual machine: Certainly! Here are some key points defining the flexibility and extensibility.
devices run Java. ??Java runs on a variety of platforms, such as window, Mac Java Virtual Machine (JVM):
OS, and the various versions ofUNIX. Today Java is being used to develop 1. Intermediary between Java Code and Operating System: JVM
12. Portability:JVM's portability enables Java applications to run on diverse
numerous types of software applications, including desktop apps, mobile apps, serves as an intermediary between Java code and the underlying operating
hardware and software platforms, making Java a popular choice for cross-
web apps, games, and much more.?? Java shares similarities with other C- system, allowing Java programs to run on different platforms without modification.
platform development.
based languages like C++ and C#, especially in terms of syntax and structure
2. Execution Environment:JVM provides a runtime environment for
Tools You Will Need in java:For performing the examples discussed in executing Java bytecode, which is the compiled form of Java source code.
.primitive data type:Primitive data types are predefined by the language
this tutorial, you will need a Pentium 200-MHz computer with a minimum of 64 and named by a keyword. There are eight primitive data types supported by
3. Platform Independence: JVM enables platform independence by
MB of RAM (128 MB of RAM recommended). Java. Below is the list of the primitive data types:
interpreting Java bytecode and translating it into machine code specific to the
host system at runtime. #Byte: The byte data type is an 8-bit signed two's complement integer with a
You will also need the following softwares −
minimum value of -128 (-27) and a maximum value of 127 (inclusive) (2 7 -
4. Memory Management:JVM manages memory allocation and deallocation, 1). ??The default value of a byte variable is 0, which is used to save space in
 Linux 7.1 (or higher) or Windows xp/7/8 operating system or higher
 Java JDK 8 or higher including garbage collection to reclaim unused memory and prevent memory large arrays, which is mainly beneficial in integers since a byte is four times
 Microsoft Notepad or any other text editor leaks. smaller than an integer.

5. Security:JVM enforces security features such as sandboxing to restrict #Short: The short data type is a 16-bit signed two's complement integer, which
Features of java: provides a range of values from -32,768 (-215) to 32,767 (inclusive) (2 15 -1). Like
untrusted code from accessing system resources, enhancing the overall security
the byte data type, the short data type is also beneficial for saving memory, as it
 Simplicity:Java's syntax is designed to be easy to learn and use, reducing the of Java applications. occupies less space compared to an integer, being only half the size.The default
complexity of coding. value for a short variable is 0.
6. Optimization:JVM includes Just-In-Time (JIT) compilers that dynamically
 Object-Oriented Programming (OOP):Java is a fully object-oriented optimize bytecode into native machine code for improved performance during #Int: The int data type is a 32-bit signed two's complement integer, allowing for
language, promoting code organization, reusability, and maintainability through program execution. a wide range of values from -2,147,483,648 (-231) to 2,147,483,647 (inclusive)
concepts like inheritance, polymorphism, and encapsulation. (231 -1). Here the integer is generally used as the default data type for integral
 Platform Independence:Java's code can run on any platform that supports the 7. Class Loading:JVM loads Java classes and verifies them for correctness values unless there is a concern about memory.
Java Virtual Machine (JVM), thanks to its bytecode and the JVM. before execution, ensuring type safety and preventing runtime errors.
The default value for an int variable is 0.
 Robustness:Java's strong typing, exception handling, and automatic garbage
collection help ensure application stability and reliability.
8. Exception Handling:JVM handles exceptions and errors that occur during
program execution, providing a robust mechanism for error detection and #Long: The long data type is a 64-bit signed two's complement integer, capable
 Security:Java has built-in security features, including access control, encryption, recovery. of representing a vast range of values from -9,223,372,036,854,775,808 (-263) to
and secure communication, to protect programs and data. 9,223,372,036,854,775,807 (inclusive) (263 -1). This data type is used when a
 High Performance:Java's Just-In-Time (JIT) compilation and other optimization 9. Multi-Threading Support:JVM supports multi-threading, allowing Java wider range than int is needed, where its default value is 0L.
techniques contribute to efficient code execution, especially in applications like programs to execute multiple threads concurrently for improved performance and
Android apps. responsiveness.

#Float: The float data type is a single-precision 32-bit IEEE 754 floating-point essential parts of an object's state that must be present throughout the
representation. It is particularly useful for saving memory in large arrays of floating-
point numbers. Its default value is 0.0f. However, it's important to note that the float class.??Instance variables can be declared in class level before or after
data type is not suitable for precise values, such as currency, due to potential
rounding errors in floating-point arithmetic. use.??Access modifiers can be given for instance variables.

#Double: The double data type is a double-precision 64-bit IEEE 754 floating-
point representation, which is generally used as the default data type for decimal
values, generally the default choice. Double data type should never be used for . 3.Java Class/Static Variables:Class variables also known as static
precise values such as currency, where its default value is 0.0d.
variables are declared with the static keyword in a class, but outside a method,
#Boolean:The boolean data type represents a single bit of information and can constructor or a block.??There would only be one copy of each class variable per
hold one of two possible values: true or false. This data type is used for simple
class, regardless of how many objects are created from it.??Static variables are
flags that track true/false conditions where its default value is false
rarely used other than being declared as constants. Constants are variables that
are declared as public/private, final, and static. ?? Static variables are stored in
Variables: A variable provides us with named storage that our programs can
the static memory. It is rare to use static variables other than declared final and
manipulate. Each variable in Java has a specific type, which determines the size
and layout of the variable's memory; the range of values that can be stored within used as either public or private constants.??Static variables are created when
that memory; and the set of operations that can be applied to the variable.
the program starts and destroyed when the program stops.??Visibility is similar
#syntax= data type variable [ = value][, variable [ = value] ...] ; to instance variables. However, most static variables are declared public since
Types of variables they must be available for users of the class.

1. Java Local Variables:Local variables are declared in methods, constructor,


or blocks.??Local variables are created when the method, constructor or block is
entered and the variable will be destroyed once it exits the method, constructor,
or block.??Acces modifier cannot be used for local variables.??Local variables
are visible only within the declared method, constructor, or block.??Local
variables are implemented at stack level internally.??There is no default value for
local variables, so local variables should be declared and an initial value should
be assigned before the first use.

2. Java Instance Variables:Instance variables are declared in a class, but


outside a method, constructor or any block.??When a space is allocated for an
object in the heap, a slot for each instance variable value is created.??Instance
variables are created when an object is created with the use of the keyword 'new'
and destroyed when the object is destroyed.??Instance variables hold values
that must be referenced by more than one method, constructor or block, or

You might also like