Skip to main content

Posts

Showing posts from October, 2018

Literals in JAVA notes

Literals: ( Java is case sensitive language except some cases: l or L (explicit conversion for long) b or B (for binary form representaion preceded by 0 ex:0B or 0b) f or F (for denoting explicitly float ) A-F or a-f (range in Hexadecimal Notation) x or X (for denoting Hexa form preceded by 0 : ex 0X or 0x) ) A) Integer Literals: i) Decimal Representation:10 ,20 ,40 ii) Hexadecimal Literals:0x123A , 0x 343F iii) Binary Representation: 0b101110 iv) Octal Representation: 0117, 01121 v) (underscore Representation): 1_2__3 ,12_3,1_2_3_4 _ is just a separator which is removed by the compiler. NOTE: 1.underscore should come only between the numbers. 2. We can have more than one underscore also in between the numbers. 3. Compiler skips all the underscore and represents the integer literals in the actual form. It means _ representation is provided for the programmers to represent large number easily

Thread in Java and Hooking concept

THREAD: Thread is the lightweight Process(uses Shared Memory of application). States: Mansur, [01.10.18 09:35] Thread is a lightweight (uses the shared memory of application) process (program in execution in waiting state). Multiprogramming execution of more than one application (vlc and notepad execute at a time) Multithreading executes more than one threads in a single application. (in NFS 4 cars are executing at a time) States of threads: New state->ready .->running/waiting->dead state To create thread: 1.Extending Thread Class it contains start() method. 2.BY implementing Runnable Interface . Start () method is present in the Thread class. It is used to create Thread. Whenever the Start method of Thread class is called it registers the thread into Thread Scheduler and calls the run method. Recommendation: we should not override start method in implementing class or extending class ot

Exception Handling in Java

Exception Handling() it is an event that stops the normal flow of execution of the program and terminates the program abnormally. Exception always occurs at runtime. There Is two type of Exception: Checked Exception.:-The exception which is checked by the compiler at the compilation time. Ex: IOException,ClassNotFoundException. Unchecked Exception: The Exception which Cant be checked by the compiler at the compilation time and directly occurs at runtime is called an unchecked Exception. Ex:NullPointerException,StringIndexOutOfBoundsException. Error: Error is the type of unchecked Exception which occurs due to programmers mistake, end-user input mistake, resource unavailability or network problem etc. OutOfMemoryError StackOverFlowError etc. 5 keywords to handle Exception: try catch finally throw throws possible combination: try-catch try-catch-catch try-catch-finally try finally try-