Last Updated At 2020-06-15

Methods in Java:A Java method is having statements that are combined together to perform an action. When invite the System.out.println() method.Creating Method:For creating a method we must have the same method header and method bodySyntax:public static int methodName(int a, int b){//body}Here Public static is an modifier ,int is a return type, a and b are ParametersMethod Calling:For calling a method there are two ways that is return a value and no return value. When a method calling a program invokes a method, and control by called method then returns control to the caller in two conditions, when the return statement is executed, it reaches the method ending closing brace.Example:The getArea() method in the Square class that was explained in the below on objects returns an integer:// a method for computing the area of the square Public int getArea() { return width * height; }File and Input/ Output Stream:This class can be used for performing and reading operation from a resource byte by byteSyntax: DataInputStream dis= new DataInputStream(InputStream);FileInputStream:This class can be used for reading the data from a file byte by byte and BufferedInputStream is a altered stream using which we can improve the performance of the application.Syntax:FileInputStream fis= new FileInputStream(File);FileInputStream fis= new FileInputStream(string);BufferedInputStream bis= new BufferedInputStream(InputStream);Example:Import java .io.*;Public class FileReading{Public Static Void main (string [ ] ar) throws IO Exception {FileInputStream fis = new FileInputStream (“input.txt”);BufferedInputStream bis= new BufferedInputStream (fis);Int ch ;While ((ch=bis. read ( ) ) ! =-1) {System.out.println((char)ch); }bis.close( );}}FileOutputStream: It is used for writing the content into a file byte by byteSyntax: FileOutputStream fos= new FileOuputStream(File);FileOutputStream fos= new FileOuputStream(string);Exceptions:An Exception is a Runtime Error which occurs because of logical failure or invalid input or wrong data. The exception class is super most class of all Exceptions.The Exceptions are classified into two types
Procedure to create a thread by extending thread class:
Collection:It is an object which can store group of other objects every object requires 10 bytes of memory and to store 4 objects .we require 40 bytes of memory .Hence 4 objects are stored one time inside the collection object and one time outside the collection object and wasting the memory by duplication.
- Compile time Exception
- Run Time Exception
- Checked Exception
- Unchecked Exception
JAVA Tutorial Video
[embed]https://www.youtube.com/watch?v=UbpbqqIw_3Q [/embed]The Exception class has two main subclasses:If a class is specified inside anther class then it is called inner class or nested class.The inner classes are the helper classes to the outer classes based on the location of the inner classes the keyword is specified.- Regular inner class
- Method inner class
- Anonymous inner class
- Static inner class
- inner Method( );

- Declare a class which extends from thread class
- Specifying the functionality of user defined in run ( )
- Create an object of a class which extends from thread class
- Attach the above created object to the main thread
- Execute the functionality of user defined thread available in run( ) by using start( )
- Declare a class which implements runnable interface
- Specifying the functionality of user defined thread in run( )
- Create an object of that class which implements runnable interface
- Attach the above created object to the main thread
- Execute the functionality of user defined thread available in run( ) by using start ( )

- To overcome of the array concept it drawbacks the sun Micro systems has released collections in java 2 version.
- In order to avoid the wastage of memory the JVM will store the references of the objects instead of storing the objects directly.

- This collection is a combinations multiple objects ,it stores instance of an object to handle the set.
- Collection object is a collection the references of other objects and class whose object can store group of references of other objects.