PDF Google Drive Downloader v1.1


Report a problem

Content text Java Revision Notes

Unit 1 Java C++ Java does not support pointers, unions, operator overloading and structure. C++ supports pointers, unions, operator overloading and structure. Java supports garbage collection. C++ does not support garbage collection. Java is platform independent. C++ is platform dependent. Java supports inheritance except for multiple inheritance C++ supports inheritance including multiple inheritances Java uses compile and interpreted. C++ uses only compiled. Java Support object-oriented programming model only. C++ Allows both procedural programming and object-oriented programming. Portability: Bytecode classes are transferrable to platform-specific JVM's; hence the code is portable. Portability: The source must be recompiled for the platform; hence the code is not portable. JDK – Java Development Kit (in short JDK) is Kit which provides the environment to develop and execute(run) the Java program. JDK is a kit (or package) which includes two things a. Development Tools (to provide an environment to develop your java programs) b. JRE (to execute your java program). Note: JDK is only used by Java Developers. JRE – Java Runtime Environment (to say JRE) is an installation package which provides environment to only run (not develop) the java program (or application) onto your machine. JRE is only used by them who only wants to run the Java Programs i.e. end users of your system. JVM – Java Virtual machine (JVM) is a very important part of both JDK and JRE because it is inbuilt in both. Whatever a Java program is run using JRE or JDK, it goes into JVM and JVM is responsible for executing the java program line by line hence it is also known as interpreter.
In java we use both compiler and interpreter. 1. First the source (what we write) is converted into BYTECODE using a compiler. 2. This BYTECODE is then executed using an interpreter. Elements of Java: 1. Keyword: Keywords are pre-defined or reserved words in a programming language. Each keyword is meant to perform a specific function in a program. 2. Identifiers: Identifiers are used as the general terminology for naming of variables, functions and arrays. These are user-defined names consisting of an arbitrarily long sequence of letters and digits with either a letter or the underscore (_) as a first character. 3. Literals: They are a sequence of characters that represents constant values to be stored in variables. 4. Constant: A constant is a variable whose value cannot change once it has been assigned. To define a variable as a constant, we just need to add the keyword “final” in front of the variable declaration. final float pi = 3.14f; The above statement declares the float variable “pi” as a constant with a value of 3.14f. We cannot change the value of "pi" at any point in time in the program. Later if we try to do that by using a statement like “pi=5.25f”, Java will throw errors at compile time itself.
Data Types in Java Data types specify the different sizes and values that can be stored in the 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. Data Type Default Value Default size Boolean false 1 bit char '\u0000' 2 bytes byte 0 1 byte short 0 2 bytes int 0 4 bytes long 0L 8 bytes float 0.0f 4 bytes double 0.0d 8 bytes
Operators in Java Operator in Java is a symbol which is used to perform operations. For example: +, -, *, / etc.

Related document

x
Report download errors
Report content



Download file quality is faulty:
Full name:
Email:
Comment
If you encounter an error, problem, .. or have any questions during the download process, please leave a comment below. Thank you.