00:00
/* 001-a-data-type.java.html */ Intro: Туре Size(in bits) byte decimal value Range boolean 1 1 -do- true or false byte 8 1 255 -128 to 127 short 16 2 65535 -32,768 to 32,767 char 16 2 -do- 0 to 65,535 int 32 4 4294967295 -2^31 to 2^31-1 long 64 8 -do- -2^63 to 2^63-1 float 32 4 -do- 1.4e-045 to 3.4e+038 double 64 8 -do- 4.9e-324 to 1.8e+308 // [ ma-: bbsc-ilfd, 1, 8, 16, 16, 32, 64, 32, 64 ] letter B Bsc Ill Fever Down
/* 001-B */ Data type in java Primitive Data Types Boolean - Boolean Character - char Integer - byte - short - int - long Float - float - double Non-Primitive Data Types - Class - Array - Interfaces - String - Enum
/* 002-b-data-type.java.html */ lets suppose raj is a data type & size is 2 bit. hi-: iska matlab decimal me koi bhee data ho 0 se 3 tak , hameysha 2 bit ka size leyga. aur yahe baat sare data type ke leeaye hai that mean it can save 2^2 .i.e 4 values in binary which is 00 = [ 0 * 2^1 + 0 * 2^0 ] = 0 01 = [ 0 * 2^1 + 1 * 2^0 ] = 1 10 = [ 1 * 2^1 + 0 * 2^0 ] = 2 11 = [ 1 * 2^1 + 1 * 2^0 ] = 3 same thing is with other data types Notes: Point - 1 int k = 1 int k = 21 in both case the memory occupied by the int variable remains the same. it determines the amount of memory it consumes, and it doesnot change based on the specific value stored in the variable. Point - 2 The "range" of a data type refers to the range of values that can be represented by that data type. The range -2,147,483,648 to 2,147,483,647 (inclusive). ( one bit is used to represent the sign (positive or negative) ). example int x = 2147483647; /* maximum positive value for an int */ now add 1 in int then op will be -2147483648
/* 003-a-local_variables.java.html */ class A /* class */ { int a =10; /* instance */ static int b = 20; void add() /* method */ { int c = 30,d; /* local variable */ d = a+b+c; sop(d); } void mul() { int e=40,f; e=d+1 /* cant access local directly, eR.. */ f = a*b*c*e; sop (c); } } 1. local = declare within a mt/ct/bk = scope inside mt/ct/bk = memory allocation , when mt/ct/bk execute, exit destroy = stack memory allocation = doen not have default value. // [ DSMT VSA ] = Daro nahe kisMAT, gao ke aadmi ko ViSA deygee usa jaane ka . local = गाँव का लोकल सीधा साधा छोटा आदमी | = Declare (aawas) - यह छोटा आदमी है सिर्फ ब्लॉक (mt/ct/bk) में ही रह सकता है | = Scope (pahuch) - क्योंकि यह छोटा आदमी है तो इसकी पहुंच सिर्फ अपने ब्लॉक तक ही है | = memory allocation (logo ko inski yaad kab aate hai ) - जब-जब नेता लोगों को ब्लॉक में इलेक्शन एग्जीक्यूट करने होते हैं तब इसकी याद आती है | = memory type (yaddash) - इसकी खुद की मेमोरी बहुत कमजोर है क्योंकि जिम्मेदारियां इसके सर पर एक के ऊपर एक स्टाकिंग के रूप में है | = default-value (ijjat) - खुद की कोई वैल्यू नहीं है | = specifier (vishisth) - यह विशेष या विशिष्ट नहीं है जैसे मिस्टर मिस या सर | = access (yatra kaha tak ) - केवल गांव के ब्लॉक में ही इसको बुला सकते हैं ब्लॉक के बाहर के लोगों को इसका पता भी नहीं है |
/* 004-b-instance_variables.java.html */ class A /* class */ { int a =10; /* instance */ static int b = 20; void add() /* method */ { int c = 30,d; /* local variable */ d = a+b+c; sop(d); } void mul() { int e=40,f; e=d+1 /* cant access local directly, eR.. */ f = a*b*c*e; sop (c); } } 2. instance = declare within a class , but outside mt/ct/bk = scope all mt/ct/bk with class, but not inside the static method directly = memory allocation ,- when object is created variables allocated - when object get destroyed/ delete , release memory = memory heap memory = defalult value = yes, int =0 , boolean = false, object = null = access specifier yes = how to access - directly ( in simple method ), - by using object ( in static method ) // [ DSMT DAA ] /* instance = shaher ka hoshiyar aadmi jo instagram chalata hai . instance = Declare (MCB) - yah bade shahaer(class) lakin gaon me (block-mt/ct/bk) nahe rahta hai. = Scope(pahuch) - bada aadmi hai iski pahuch apne shaher aur gaon me (block-mt/ct/bk) me bhee hai .lakin yah vedeshi vyakti ke area ( embessy )mai nahe ja sakta hai . = memory allocation(yaad) - iski yaad neta logo ko tab aati hai kuch kaam galat ho aur ye uspar objection uthaye aur leagel ki baat kare. = memory type - is aadmi(he) memory kaam hoti ja rahe hai kyuki iska kaam hai roz shaam ko peene ka. = default-value (ijjat) - iski apne valu hai = specifier (ma specific hi-: vishisth) - daba aadmi hai to specific vishist . = access - kyuki ye bahut popular hai to isko koi bhee gao (blocks mt/ct/bk) ya shaher me bula sakta hai. */
/* 005-c-static_variables.java.html */ variable - name of memory locations type -local -instance -static class A /* class */ { int a =10; /* instance */ static int b = 20; void add() /* method */ { int c = 30,d; /* local variable */ d = a+b+c; sop(d); } void mul() { int e=40,f; e=d+1 /* cant access local directly, eR.. */ f = a*b*c*e; sop (c); } } 3. static = declare, in class using static keyword, but outside mt/ct/bk = scope, inside mt/ct/bk including static mt/ct/bk = memory allocation ,- when we run program & . class file is loaded , variable allocated , - when class file gets unloaded variables get destroyed = memory , non heap memory or static memory = default value , similar to instance variable = access specifier , can be used = how to access - directly - by using class name - by using object reference name // [ ma-: DSMT DAA ] hi-: Daku Sabnam Mall ke Tala tod kar DAkA dala. /* static= american aadmi jo states me rahta hai (USA) . static= Declare (MCB) - iski embessy jis shaher me instance rahta hai lakin ye gao me nahe rahta . iske shirt par hameysah state ka label laga rahta hai . = Scope(pahuch) - iski pahuch gao ,shaher aur embessy (blocks mt/ct/bk) sab gajah hai . = memory allocation - iski yaad sab ko rahtee hai agar koi bhulta hai to ye uski class laga deyta hai . = memory type - is aadmi ko apne memory me roz apna ghar dikhta hai jo ki state me hai. = default-value (ijjat) - iski apne value hai = specifier (ma specific hi-: vishisth) - daba aadmi hai to specific vishist . = access - isko shaher, gao(object ki help se) aur embessy sabhee bula sakte hai lakin uske leeaye kuch special treatment deyne hoge. */
/* 006-d-variables_with_example.java.html */ class Abc { int a = 10; static int b = 20; public static void main (String arg[]) { Abc ob1 = new Abc(); system.out.print(ob1.a); //10 system.out.print(ob1.b); //20 ob1.a= 1000; ob1.b= 2000; system.out.print(ob1.a); //1000 system.out.print(ob1.b); //2000 Abc ob2 = new Abc(); system.out.print(ob2.a); //10, when create a new object instance variable create a new memory system.out.print(ob2.b); //2000, static value not initilize again , reshare its value } } Terms- 1. instance variable = is a variable that belongs to an instance of a class 2. instance = refers to a single occurrence of a class. An instance, also known as an object, is created from a class using the new keyword. The class serves as a blueprint or template, defining the structure and behavior of the objects that will be created. 3. static variable = is a class variable that belongs to the class rather than to instances (objects) of the class. Unlike instance variables, which have separate copies for each instance of the class, static variables are shared among all instances of the class and can be accessed using the class name. They are often used to represent information that is common to all instances of a class, such as a counter or a constant value. Accessing a static variable is done using the class name rather than an instance of the class (MyClass.staticVar), although it can also be accessed through an instance.Home Paris Paris
/* 007-operators-Literals-Identifiers.java.html */ operators and literals 1. opertaors = are the special symbols which perform any operations on one or more operands a++ ( one operands ) a=a+1 ( more operands ) 2. literals = the value assign to a variables is knows as literals ( like = int a = 10;, 10 is literals ) 3. keywords = are the predifined words having any specific meaning 50 keywords, use 48, goto/const = not use, 3 words = ture/false/null, identifiers 1. any name can be variable name, method name class name interface name like int a = 10; class abc a = s variable / identifier abc = identifier 2. rule cant use space only _ and $ sign reserved cant use integer cant use at first position 3. naming conventions variable = my , my_name, my_name_java method = my(), myName(), myNameJava(); class/interface = My, MyName, MyNameJava // [ DIOL = Date type , indentifier, operator ,literals ]
/* 008-java-hsitory-feature.java.html */ Java Intro -1 1. high level programming language based on object orientation 2. progammming langauge 3. it is a plateform 4. it has its own runtime envoirnment call jvm History 1. james goslin and its team, 2. sun microsystem -1991 3. oak first name 4. first version - 1995 java alpha beta version 5. 1996 - jdk 1.0 6. 2017 - java se 7. java - 2010- oracle Featurs 1. plateform independent (need jvm) 2. portable 3. secure language 4. jvm 5. verify the byte code 6. security manager 7. no pointers 8. access modifiers 9. exception handling 10.owm memory management 11. oops concepts 12. robust 13. multithreading 14. simple as compair to c c++ use of java 1. android app 2. financial servicesHome Paris Paris
/* 010-java-program-explained.java.html */ java program explained class Abc { public static void main (String [] args) { System.out.println("hello"); } } 01. class - keyword - symtax = acces modifier class ClassName - can create many class , but only one main class - only one public class 02. Abc - idnetifer ( className ) 03. Public - access modifier ( if jdk in c drive and program in d drive can access only if the main method is public ) 04. Static - jvm directly call main method w/o creating the object and that is why we use static keyword for main method ( class level ) 05. Void - return type keywrod - it return nothing (not even null and 0 ), - if it is int , it return the int value to jvm and jvm dont process it. 06. main - predefined method ( jdk starts with main method ) 07. String - class - java process everything in string ,coz they are immutable 08. [] - defined array 09. args - arguments or array name 10. systme - predefined class , location java.lang 11 out - static variable of printstream class , location system class 12. println - method of printscreen class 13. print() - simple print 14. println() - o/p in next line 15. printf() - use with format specifier (%d, %s ) changes that acceptable 01 - static public void main () - order of the modifier can be changes 02 - string[] args - string args[] - string []args 03 - can change array name can give any identifier name instead of args 04 - we can use var args instead of string[] - public static void main (String...args) 05 - we can use final synchronized and stritfp with main method
/* 011-java-file-dot-class-file.java.html */ 1. jfava files is saved with any like raj.java 2. run the file with the file name ( like raj.java) 3. the dotlass file will generate by the class name. 4. if program has n number of class then the n number of dot class files will generate. 5. only the main classs ( which contain the main method ) will run //MA = [ FSRDC, = FILE > SAVE > RUN > DOTCLASS > CLASSNAME ] 6. permanent path setting > My computer > property > advance setting > envoirnment variables > > user vairables > system variables > user vairables > new > variable name = path > variable value = c/progaram files/ java/ jdk1.8.0/bin > user vairables > already has a path variables > edit it > ; semicolumn at end > copy paste the path 7. for check > cmd > javac > show info about it // ma // java file > raj.java > run > raj.clas > run > progrma execute // n number of class file, but run only main Home Paris Paris
/* 012-jvm-architect.java.html */ 1. JVM - [ Load dot class + Execute ] 2. class loader -- LLI 3. > L- BEA > B - responsible to load the classes present rt.jar > E - responsible to load the classes from extension class path. > A - responsible to load the class for the application class path. 4. > L- VPR > V - weather .class is generated by the valid compiler or not > P - jvm allocate memory to the class level static variables and assign its default values. > R - symbolic name is replaced by the original memory reference 5. > I- Load Original Value 6. Memory Area --MHSPN > M - store .class file info and static variables > H - store instance variable object and arrays > S - store current running method and local variables > P - hold address of the next executing instructions > N - all native method call invoked 7. Execution Area -- I, JIT > I - decode every statement or line in the code > JIT - code complied when it is needed , not before runtime. 8. JNI - interface allowe java to interact with other language written code. JVM inner structure part-1 1. java file --conpile-- > dot class file(byte code) 2. jvm -3 module a. Module-1 = loader: 1. Bootstrap Class Loader: 2. Extension Class Loader: 3. Application Class Loader: class loader use above three for loading dot class fiel into memory area = linking: 1. Verification: Ensures the correctness of the loaded class files. 2. Preparation: Allocates memory for class variables and initializes them with default values. 3. Resolution: Replaces symbolic references in the class with direct references. = Initialization: Executes the class's static initializers and initialization blocks. = static block execute, ststic variables default value replace by the given one b. Module-2 = memory area 1. class level data load - method area 2. jvm create object of class in heap memory ( info of class saved in method) 3. array, instance variables also saved in heap momory. c. Module-3 = execution engine Class Loader Subsystem: Responsible for loading class files into memory. Memory Area: This includes the method area, heap, stack, and program counter. Execution Engine: It executes Java bytecode. It consists of the interpreter and the Just-In-Time (JIT) compiler.
00.png
Home PREVIOUS NEXT