There are three major editions of Java: Standard Edition for desktops/laptops, Enterprise Edition for servers, and Micro Edition for mobile devices. The Java Development Kit contains the basic tools for compiling, documenting, and packaging Java programs. Key components of Java include the Java Virtual Machine and Java Application Programming Interface. Control structures like if/else, switch, while, do-while, for loops are used to control program flow.
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
44 views
Oop Short Note
There are three major editions of Java: Standard Edition for desktops/laptops, Enterprise Edition for servers, and Micro Edition for mobile devices. The Java Development Kit contains the basic tools for compiling, documenting, and packaging Java programs. Key components of Java include the Java Virtual Machine and Java Application Programming Interface. Control structures like if/else, switch, while, do-while, for loops are used to control program flow.
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1
Major editions in java
Standard Edition - runs on desktops and laptops
Enterprise edition - runs on servers Micro edition runs - on mobile devices such as cell phones Full form in java Java Development Kit Runtime environment JVM(java Virtual Machine) Command compile – “javac” / Execute – “java” Data type size (type – bits – range) Boolean – 1 – true, false / Char – 16 – 0 to 65535 Byte – 8 – -128 to +127 / Short – 16 - -32,768 to +32,767 / Int – 32 - -232 to +232-1 Long – 64 - -264 to +264-1 / Float – 32 /Double – 64 Garbage collection in Java Automatically removing of objects created, which are not using anymore. Top level elements appears in a file Package declarations /Import statements /Class definitions Identifier is a word used by a programmer to name a variable, method class or label. Declaring Variables Type identifier; / Type identifier=initial value; Java Virtual Machine(JVM) –set of computer software programs & data structures that use a virtual machine model for the execution of other computer programs and scripts. Java Runtime Environment(JRE) –A runtime environment which implements Java Virtual Machine, & provides all class libraries & other facilities necessary to execute Java programs. Java Development Kit(JDK) –The basic tools necessary to compile, document, and package Java programs (javac, javadoc, and jar, respectively). Application Programming Interface (API) –Contains predefined classes and interfaces for developing Java programs. Features of java simple, portable, robust, distributed components ◦The Java Virtual Machine ◦The Java Application Programming Interface (API) Variables are locations in memory in which values can be stored. Reference types (composite) Objects / Arrays Escape Sequence Characters \t tab, \b Backspace, \n new line, \r carriage return, \’ single quote, \” double quote, \\ backslash, \f form feed
Constructor – is a special method which initializes an object immediately upon
creation. Operator is a symbol that tells the compiler to perform a specific mathematical or logical manipulation. ( < > = ! ~ ? : ->) General classes of operators: arithmetic, bitwise, relational, logical Separators (punctuators) ( ) { } [ ] ; , . ... @ :: Control statements are the statements used to control the flow of execution of the program. Control structure sequence, selection, iteration BufferedReader A class which reads text from a character-input stream Polymorphism is a feature that allows you to provide a single interface to varying entities of the same type. implement polymorphism methods Overloading , Overriding Abstraction in Java oop Hiding the implementation details of objects from users. Achieving abstraction methods Inherit Abstract class / Implement Interfaces Exception in Java is run time error Packages in Java is a mechanism to encapsulate a group of classes, interfaces and sub packages. Java virtual machine collection of software component that enables a computers to run a java program. Major component in JDK compiler(javac), interpreter(java), JRE,Archiver(jar), Documentation generator(javadoc) Explicit casting is required when assigning a large data type to smaller data type. Iterative structure A programme construct which execute same set of instruction repetitively Advantages of usingiterative structure Reduce code, save programmer time, able to use same variable, easy to design the structure of logic. Different While and Do While loop In while loop if the connection is true then only statements in the loop will be executed. In do while loop statements within the do block are always executed at leastonce. In while loop condition is tested at the beginning of the loop.in do while loop condition is tested at the end of the logic. Different int and integer int is a primitive data type. Integer is wrapper type object Different overloading and overriding Performed within class occurs in two class –is a relationship Parameter must be different parameter must be same Different if and switch Can test many variable only one variable Any data type byte, short, char, int Can use <>== !=… only checks equality Slower than switch faster switch operation Interface is collection of abstract methods, which must be implemented by the class for inheriting interface functionality. Javax.swing package API for providing a user interface for java programs.it provides lightweight components such as JButton, JTextField, jMenu, JTextAria etc.. SetBounds Specify the position and size of the GUI component.(int x, int y, ) SetSize is used to set the size of the component. (int width, int height) Event listenerprocedure or function in computer program that wait for event to occu Wrapper class provides the mechanism to convert primitive into object & object into primitive. (wrapper classes: Boolean, character, byte, short, long) OOP Concept inheritance, polymorphism, encapsulation, abstraction Inheritance is a relationship extend keyword. code reuse. Abstract class is a template definition of methods and variables of a class that contains one or more abstracted methods. Concrete class is a class that has an implementation for all of its methods that were inherited from abstract or implemented via interface. Thread is a lightweight process Access modifiers public, protected, private Final keyword in java final variable, final methods, final classes Static keyword in java blocks, variable, methods, nested classes
Switch syntax : IF syntax : For loop:
switch (expression) { If (condition) { For (expression1; Case x: // block of code; expression2; expression3) //code ; { } Break; //code block to execute; Else { Default: } //block code //code block; } }
While loop: While (condition) { // code block to be execute; }
Do while loop: do {// code block to be execute ; } While (condition) Try catch: try { //code to try } catch (exception e) //code to handle errors } Condition operator: expression?statement 1 : statement 2; Array Container object that holds a fixed number of values of a same type Array Syntax data_type[] array_name; Literal is the source code representation of a value of a primitive type , the String type, or the null type. – IntegerLiteral – FloatingPointLiteral – BooleanLiteral – CharacterLiteral