NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

*Unit 1 & 2*

A computer Program is a set of instructions.




*Unit 3 & 4*

An *Exception* is an unexpected or error condition.

The Object Oriented techniques to manage errors comprise the group of methods known as *Exception Handling*.

*Object* is the parent class of *Throwable Class*.
*Throwable* is the parent class of *Exception Class*.

The *Try Block* is a block of code you attempt to execute while acknowledging that an exception might occur.

A *Try Block* Consists of
→Keyword Try
→Opening Curly Brace
→Executable Statements
→Closing Curly Brace


A *Catch Block* is a segment of code that can handle an exception that might be thrown by try block that precedes it.

A *Throw Statement* is one that sends an Exception out of a method so it can be handled elsewhere.

A *Catch Block* consists of
→Keyword Catch
→Opening Paranthesis
→An Exception Type
→A Name for an instance of Exception Type
→Closing Parenthesis
→Opening Curly Brace
→Statements That take action
→Closing Curly Brace


An *IndexOutOfBoundsException* occurs when an array subscript is not within the allowed range.

*Unreachable Code* statements are program statements that can never execute under any circumstances.

When you have actions you must perform at end of try...catch sequence, you can use *Finally Block*.

There are *2 Categories* of Java's Exceptions
→Checked Exception
→Unchecked Exception

*Unchecked Exception* are of 2 types
→Errors
→Runtime Exception

Programs are able to recover from *Checked Excpetions*.

Errors and RuntimeException are *Unchecked Exception*

Java provides *40* Categories of Exceptions.

The Exception class contains *4 Constructors*

The *printStackTrace()* method can help you locate origin of a thrown Exception.

*Throw* can be used to throw only one exception at a time.

*Throws* can be used to throw multiple Exception at a time.

If your *CustomException* class extends a CheckedException class than your CustomException class will also be a *CheckedException* class, and same for *UncheckedException* class.

*UML*- Unified Modeling Language

*Inheritance* is a mechanism that enables one class to inherit ,or assume,both the behavior and attributes of another class.

A *Class Diagram* is a visual tool that provides you with an overview of a class.

Class Diagram is divided in *3 Sections*
Top Section- Name
Middle Section- Name and Data Type of attribute
Bottom Section- Methods

A class that is used as a basis for inheritance is known as *Base Class*

A class that inherits from base class is known as *Derived Class*

Base Class aka *SuperClass* aka *ParentClass*
Derived Class aka *SubClass* aka *ChildClass*

*Extends* Keyword is used to achieve inheritance in java.

All instance method calls are *Virtual Method Call* by default that is the method used is determined when the program runs because the type of object used might not be known until the method executes.

Inheritance is a *One-Way Proposition*

Using the same method name to indicate different implementations is called *Polymorphism* which also means *Many Forms*

When you create a method in child class that has the same name and argument list as a method in its parent class, you *Override The Method*

The ability of one method name to work appropriately for different subclass objects of same parent class is known as *Subtype Polymorphism*

When you instantiate an object that is a member of a subclass , you are actually calling at least *2 constructors* (1 of base class, and 2nd of derived class)

The keyword *Super* always refer to superclass of a class in which you use it.

The concept of keeping data private is known as *Information Hiding*

The *Three Methods* that *Can't be Overridden in Subbclass* are
→Static
→Final
→Methods with Final class

The compiler can optimize a program's performance by removing the calls to final methods and replacing them with the extended code of their definitions at each method call location, this is known as *Inlining the Code*

A *Final Class* cannot be a parent.



*Abstraction* is the process of Hiding the implementation details and showing only functionality to user.

There are *2Ways* to achieve Abstraction
→Abstract Class(0 to 100%)
→Interface(100%)



Object can't be created of *Abstract class*
Abstract class should have atleast one *Abstract Method*

An *Abstract Method* is a method which doesn't have any body.


*Abstract Keyword* can't be applied to static methods or Constructor.

An *Interface* is a group of related methods with empty bodies and constants.

All methods declared in interface are *Abstract and Public*

Data fields in interface are *Public ,static,final*

Multiple inheritance is achieved using the *Interface Concept*

One interface can be inherited from *Multiple Interfaces*.

*Difference b/w Abstract and Interface*

*Package* is a collection of related classes and Interfaces.

Inbuilt packages are provided in *JDK(Java Devlopment Kit) Tools*

For creating a package, *Package* keyword is used.

Java provides *4 Levels of Controlling Access* to variables,methods and classes.
→Private
→Protected
→Public
→No Modifier(default) access


Java achieved Multitasking Concept using *Thread*
A thread is a *Light Weight Process*

*Difference between Process and Thread*



There are *5 States* throughout thread lifetime.
→New
→Ready to Run
→Running
→Block
→Dead


At the time of thread creation, it is *New State*
After the start() method the thread is in *Ready To Run*
By calling the *run() method* , the CPU time is allocated to thread and it enters the *Running State*
After CPU time slice expires, the thread may go back to the ready to run state if its task is uncompleted or may go to *Dead state* ,if its task is completed or may go to *Block State*

There are *2 ways* to create a thread
→By extending the Thread Class
→Implementing the Runnable Interface


There are *9 Thread Class Methods*
Public final string getName()
Public final void setName(String s)
Public final boolean isAlive()
Public final void stop()
Public static void yield()
Public final int getPriority()
Public final void setPriority(int newPriority)
Public final void join() throws InterruptedException
Public static void sleep(long milliseconds)

Thread *Lowest* priority is *1*
Thread *Highest* priority is *10*
Thread *Normal* priority is *5*

*Applets* are small java programs that are primarily used for internet computing.

Applet displays in a window which can be opened in any browser or other software like *Applet Viewer*

An applet developed locally and stored in local system is known as *Local Applet*

A *Remote Applet* is that which is developed by someone else and stored on a remote computer connected to the internet.


*Difference between Applet and Applications*

Applet doesnt contain the *Main()* method

The browser that executes an applet is generally known as *Applet Container*

There are *4 Applet States*
→Born or Initialization
→Running
→Idle
→Dead or Destroyed

Enters Initialization state by calling *init()* method

Enters Running state by calling *start()* method

*AWT*-Abstract Window Toolkit

*Graphic support* is achieved by AWT.

The *<Applet> tag* is used to execute an applet in browser.

*Attributes of Applet Tag*
→Codebase
→Code
→Alt
→Name
→Width And Height
→Align
→Vspace and Hspace
→Param

Value passing concept is called *Parameter Passing* in Applet.

*Read the Methods of Graphics class Also*
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.