Sir i need advance java notes pdf so can you please send it to me on my gmail can anyone clarify duration of corejava course under KVR sir. K V Rao Sir is the only faculty in Hyderabad, who can teach Core Java without C K V Rao Core Java pdf1 Core Java Notes PDF1; K V Rao Core Java Pdf file 2. meteolille.info Core Java notes - Free download as PDF File .pdf), Text File .txt) or read online for Download as PDF, TXT or read online from Scribd By Mr. K.V.R.
|Language:||English, Spanish, German|
|PDF File Size:||11.81 MB|
|Distribution:||Free* [*Regsitration Required]|
Core Java Notes By KV Rao/KVR PDF -Ameerpet Materials. Posted by SmlCodes. Core Java Notes By KV Rao(KVR)PDF -Ameerpet Materials. Sathaya Institute Kvr Sir Java Notes in meteolille.info for more Sathaya Institute Kvr Sir Java Notes to download in pdf format. 9 Jan, kvr core java notes. Here is the KV Rao sir core java and advance java notes, i am here providing u some useful KV Rao Sir Advance Java Notes (Download PDF). kvr-advpdf.
They are concrete classes and abstract classes. A concrete class is one which contains fully defined methods. Defined methods are also known as implemented or concrete methods. With respect to concrete class, we can create an object of that class directly. An abstract class is one which contains some defined methods and some undefined methods. Undefined methods are also known as unimplemented or abstract methods. Abstract method is one which does not contain any definition.
To make the method as abstract we have to use a keyword called abstract before the function declaration. The abstract methods make us to understand what a method can do but it does not give how the method can be implemented. Every abstract method belongs to a class under class is known as abstract class, to make the class as abstract we use a keyword called abstract before the class specification. With respect to abstract class we cannot create an object direct but we can create indirectly.
An object abstract class is equal to an object of that class which extends that abstract class. Write a JAVA program for computing sum of two integers and floats using abstract classes? Abstract classes should not be final, since, they are always reusable. Abstract classes are basically used to implement polymorphism; we use the concept of dynamic binding.
Hence, abstract classes, polymorphism and dynamic binding will improve the performance of JAVA J2EE applications by reducing amount of memory space.
Whenever we inherit n number of abstract methods from abstract base class to derived class, if the derived class defines all n number of abstract methods then the derived class is concrete class. If the derived class is not defining at least one abstract method out of n abstract methods then the derived class is known as abstract derived class and to make that class abstract, we use a keyword called abstract.
An abstract base class is one which contains physical representation of abstract methods. An abstract derived class is one which contains logical declaration of abstract methods which are inherited from abstract base class. Implement the above diagram by using abstract classs polymorphism and dynamic binding. With respect to Concrete Class: An object of either concrete base class or abstract base class contains the details about those methods which are available in that class only but this object concrete base class or abstract base class does not contains details of those methods which are specially defined in derived classs.
Write a JAVA program to display the fonts of the system? A factory method is one whose return type is similar to name of the class where it presents. RULES for factory method: The return type of the factory method must be similar to name of the class where it presents. Every factory method must be static so that we can call with respect to name of the class. Every factory method must be public. Factory methods are used for creating an object without using new operator.
Every predefined abstract class contains at least one factory method for creating an object of abstract class. Whenever we define a concrete class, that concrete class also can be made it as abstract and it is always further reusable or extendable by further classes. When we define only concrete class we may extend or we may not extend by derived classes.
Interfaces are basically used to develop user defined data types. With respect to interfaces we can achieve the concept of multiple inheritances. With interfaces we can achieve the concept of polymorphism, dynamic binding and hence we can improve the performance of a JAVA program in turns of memory space and execution time.
An interface is a construct which contains the collection of purely undefined methods or an interface is a collection of purely abstract methods.
Syntax for defining an interface: Interface is a keyword which is used for developing user defined data types. Interface name represent a JAVA valid variable name and it is treated as name of the interface. With respect to interface we cannot create an object directly but we can create indirectly. Variable declaration represents the type of data members which we use a part of interface. Whatever the variables we use in the interface are meant for general purpose the variables like PI, e, etc.
Whatever the variables we write in the interface, they are by default belongs to: All variables must be initialized otherwise it will be compilation error.
Method declaration represents the type of methods we use as a part of interface. All the methods of interface are undefined methods and to make those methods as abstract, the JAVA programmer need not to write a keyword abstract explicitly before the declaration of interface method.
Since all the methods of interface are meant for general purpose hence they must give universal access. To make it as universal access the JAVA programmer need not to write a keyword public explicitly before the method declaration. Hence, by default all the methods of interfaces belong to public abstract methods.
Syntax-1 for reusing the features of interface s to class: In the above syntax clsname represents name of the class which is inheriting the features from n number of interfaces. Implements is a keyword which is used to inherit the features of interface s to a derived class.
When we inherit n number of abstract methods from n number of interfaces to the derived class, if the derived class provides definition for all n number of abstract methods then the derived class is known as concrete class. If the derived class is not providing definition for at least one abstract class and it must be made as abstract by using a keyword abstract.
One class can extend only one class. One class can implement n number of interfaces. One interface can extends more than one interface. Interface cannot implements or extends a class.
Since defined things cannot be made as undefined things. Syntax-2 inheriting n number of interfaces to another interface: If one interface is taking the features of another interface then that inheritance is known as interface inheritance Syntax Whenever we use both extends and implements keywords as a part of JAVA program we must always write extends keyword first and latter we must use implements keyword.
Important points: An object of interface cannot be created directly since it contains n number of abstract methods. An object of interface can be created indirectly. An object of base interface contains the details about those methods which are declared in that interface only but it does not contain details about those methods which are specially available in either in derived classes or in derived interfaces.
Interfaces should not be final. An interface does not contain Constructors. A sub-package in turns divides into classes, interfaces, sub-sub-packages, etc. Learning about JAVA is nothing but learning about various packages. By default one predefined package is imported for each and every JAVA program and whose name is java. Whenever we develop any java program, it may contain many number of user defined classes and user defined interfaces.
In java we have two types of packages they are predefined or built-in or core packages and user or secondary or custom defined packages. Core packages of java starts with java. As a part of J2SE we have nine predefined packages which are given in the following table: Package name java. This is the package which is by default imported for each and every java program. This package is used for developing file handling applications, such as, opening the file in read or write mode, reading or writing the data, etc.
This package is used for developing GUI Graphic Unit Interface components such as buttons, check boxes, scroll boxes, etc. Event is the sub package of awt package. This package is used for providing the functionality to GUI components, such as, when button is clicked or when check box is checked, when scroll box is adjusted either vertically or horizontally.
This package is used for developing browser oriented applications. In other words this package is used for developing distributed programs. An applet is a java program which runs in the context of www or browser. This package is used for developing client server applications. This package is used for developing quality or reliable applications in java or J2EE. This package contains various classes and interfaces which improves the performance of J2ME applications.
This package is also known as collection framework collection framework is the standardized mechanism of grouping of similar or different type of objects into single object. This single object is known as collection object. This package is used for formatting date and time on day to day business operations. Reflect is the sub package of lang package. This package is basically used to study runtime information about the class or interface.
Runtime information represents data members of the class or interface, Constructors of the class, types of methods of the class or interface. This package is used for retrieving the data from data base and performing various operations on data base.
Any class or interface is commonly used by many java programmers that class or interface must be placed in packages. Here, package is a keyword which is used for creating user defined packages, pack1 represents upper package and pack2 to packn represents sub packages.
The statements 1 and 2 are called package statements. Whenever we create user defined package statement as a part of java program, we must use package statement as a first executable statement. Whenever we develop any JAVA program it contains n number of classes and interfaces. Each and every class and interface which are developed by the programmer must belong to a. Choose the appropriate package name, the package name must be a JAVA valid variable name and we showed ensure the package statement must be first executable statement.
Choose the appropriate class name or interface name and whose modifier must be public. The modifier of Constructors of a class must be public.
The modifier of the methods of class name or interface name must be public. At any point of time we should place either a class or an interface in a package and give the file name as class name or interface name with extension. Here, -d is an option or switch which gives an indication to JVM saying that go to Test.
When Test. The above program cannot be executed since it doesnt contain any main method. In order to refer package classes and interfaces in JAVA we have two approaches, they are using import statement and using fully qualified name approach.
Using import statement: Import is a keyword which is used to import either single class or interface or set of classes and interfaces all at once. When statement 1 is executing we can import or we can access all the classes and interfaces of package p1 only but not its sub packages p2 and p3 classes and interfaces. When statement 2 is executing we can import as the classes and interfaces of package p2 only but not p1 and p3 classes and interfaces.
When statement 3 is executing we can import as the classes and interfaces of package p3 only but not p1 and p2 classes and interfaces. Import pack1 [. When statement 4 is executing can import c1 class of package p1 only but not other classes and interfaces of p1 package, p2 package and p3 package. Write a JAVA program which illustrates the usage of package classes? Import approach: When we compile the above program we get the following error package tp does not exist.
To avoid the above error we must set the classpath as. Fully qualified approach: Test ; t1. Whenever we develop user defined packages, to use the classes and interfaces of user defined packages in some other program, we must set classpath before there usage.
In order to set the classpath for predefined packages we must use the following statement: When two classes or an interface belongs to the same package and if they want to refer those classes or interfaces need not to be referred by its package name. C02" ; cp. C02 ; o2. C01" ; cp. C02 ; o1. C02 ; io. In order to run the above program we must run with respect to package name. In JAVA we have four types of access specifiers. They are private, default not a keyword , protected and public.
Access specifiers makes us to understand how to access the data within the package class to class, interface to interface and interfaces to class and across the package class to class, interface to interface and interfaces to class.
In other words access specifiers represent the visibility of data or accessibility of data. Syntax for declaring a variable along with access specifiers: Private Same package base class Same package derived class Same package independent class Other package derived class Other package independent class.
Private access specifier is also known as native access specifier. Default access specifier is also known as package access specifier. Protected access specifier is also known as inherited access specifier. Public access specifier is also known as universal access specifier. Write a JAVA program which illustrates the concept of access rules? Sbc; import sp. Sdc; import sp. Odc ; System. Nameless object approach: Sometimes there is no necessity for the JAVA programmer to create an object with some name.
In such situations we can use the concept of nameless object. To convert the above statements into nameless object approach follow the following statements. Every technology or every programming language, if we use for implementing real time applications and if the end user commits a mistake then by default that language or technology displays system error messages which are nothing but run time errors.
Run time errors in JAVA are known as exceptions. System error messages are those which are unable to understand by end user or client. User friendly messages are those which are understandable by end user or client.
Exceptional handling is a mechanism of converting system error messages into user friendly messages. Errors are of two types. They are compile time errors and run time errors. Compile time errors are those which are occurring because of poor understanding of the language. Run time errors are those which are occurring in a program when the user inputs invalid data. The run time errors must be always converted by the JAVA programmer into user friendly messages by using the concept of exceptional handling.
In JAVA run time environment, to perform any kind of operation or task or an action that will be performed with respect to either class or an interface. Whenever we pass invalid data as an input to t the he JAVA program then JAVA run time environment displays an error message, that error message is treated as a class.
Types of exceptions: In JAVA we have two types of exceptions they are predefined exceptions and user or custom defined exceptions. Predefined ned exceptions are those which are developed by SUN micro system and supplied as a part of JDK to deal with universal problems.
Some of the universal problems are dividing by zero, invalid format of the number, invalid bounce of the array, etc. Predefined exceptions are divided into two types. They are asynchronous exceptions and synchronous exceptions. Asynchronous exceptions are those which are always deals with hardware problems.
In order to deal with asynchronous exceptions there is a predefined class called java. Error class is the super class for all asynchronous exceptions.
Synchronous exceptions are one which always deals with programmatic errors. In order to deal with synchronous exceptions we must use a pred predefined class called java. Exception class. Exception is the super class for all synchronous exceptions. Synchronous exceptions are divided into two types. They are checked exceptions and unchecked exceptions. A checked exception is one which always deals with compile time errors regarding class not found and interface not found.
An exception is an object which occurs at run time which describes the nature of the message. The nature of the message can be either system error message or user friendly message. JRE contacts to java. Throwable for finding what type of exception it is. Throwable decides what type of exception it is and pass the message to JRE.
Error class or java. Exception class will fo found an appropriate sub class exception. Either java. Exception class gives an appropriate exception class to JRE. JVM will create an object of appropriate exception class whi which ch is obtained from JRE and it generates system error message. In order to make the program very strong robust , JAVA programmer must convert the system error messages into user friendly messages by using the concept of exceptional handling.
User friendly y messages are understand by normal user effectively hence our program is robust. Syntax for exceptional handling: In order to handle he exceptions exceptions in JAVA we must use the following keywords.
They are try, catch, finally, throws and throw. Try block: This is the block in which we write the block of statements which are to be monitored by JVM at run time i. If any y exception is taking place the control will be jumped automatically to appropriate catch block.
If any exception is taking place in try block execution will be terminated and the rest of the statements in try block will not be executed at all and the control control will go to catch block.
For every try block we must have at least one catch block. It is highly recommended to write n number of catchs for n number of problematic statements. Catch block: This is used for providing user friendly messages by catching system error messages. In the catch we must declare an object of the appropriate execution class and it will be internally referenced JVM whenever the appropriate situation taking place. If we write n number of catchs as a part of JAVA program then only one catch will be executing at any point.
After executing appropriate catch block even if we use return statement in the catch block the control never goes to try block. Finally block: This is the block which is executing compulsory whether the exception is taking place or not.
This block contains same statements which releases the resources which are obtained in try block resources are opening files, opening databases, etc. Writing the finally block is optional. Throws block: This is the keyword which gives an indication to the calling function to keep the called function under try and catch blocks. Write a JAVA program which illustrates the concept of throws keyword?
Number of ways to find details of the exception: In JAVA there are three ways to find the details of the exception. They are using an object of java. Exception class, using public void printStackTrace method and using public string getMessage method. Using an object of java. An object of Exception class prints the name of the exception and nature of the message. Using printStackTrace method: This is the method which is defined in java. Throwable class and it is inherited into java. Error class and java.
This method will display name of the exception, nature of the message and line number where the exception has taken place. Using getMessage method: This is also a method which is defined in java. Throwable class and it is inherited into both Error and Exception classes. This method will display only nature of the message.
Guide lines for developing user defined exceptions: Choose the appropriate package name. Choose the appropriate user defined class. Every user defined class which we have choose in step 2 must extends either java. Exception or java. RunTimeException class. Every user defined sub-class Exception must contain a parameterized Constructor by taking string as a parameter.
Every user defined sub-class exception parameterized Constructor must called parameterized Constructor of either java. RunTimeException class by using super string parameter always.
Write a JAVA program which illustrates the concept of user defined exceptions? Nage; import ap. Age ; Ao. Main method should not throw any exception since the main method is called by JVM and JVM cannot provide user friendly message. They are standalone applications and distributed applications. A standalone application is one which runs in the context of local disk and whose result is not sharable. Every standalone application runs from command prompt and it contains main method along with System.
A distributed application is one which runs in the context of browser or World Wide Web and it can be accessed across the globe. Any technology which runs in the browser will have n number of life cycle methods and it does not contain main methods and System. In order to deal with applets we must import a package called java. This package contains only one class Applet whose fully qualified name is java. Since applets are running in the browser, the class Applet contains the life cycle methods.
Life cycle methods are also called as loop back methods. In java. Applet we have four life cycle methods. They are public void init , public void start , public void stop and public void destroy.
Public void init: This is the method which is called by the browser only one time after loading the applet. In this method we write some block of statements which will perform one time operations, such as, obtaining the resources like opening the files, obtaining the database connection, initializing the parameters, etc. Public void start: After calling the init method, the next method which is from second request to sub-sequent requests the start method only will be called i.
In this method we write the block of statement which provides business logic. Public void stop: This id the method which is called by the browser when we minimize the window. In this method we write the block of statements which will temporarily releases the resources which are obtained in init method. Public void destroy: This is the method which will be called by the browser when we close the window button or when we terminate the applet application.
In this method we write same block of statements which will releases the resources permanently which are obtained in init method. Another method which is not a life cycle method is public void paint.
This is the method which will be called by the browser after completion of start method. This method is used for displaying the data on to the browser.
Paint method is internally calling the method called drawString whose prototype is given below. An object of Graphics class will be created automatically after loading the applet into the browser. Import java. Applet package. Choose the user defined class that must extends java.
Applet class and ensure the modifier of the class must be public. Overwrite the life cycle methods of the applet if require.
Save the program and compile. Run the applet: To run the applet we have two ways. They are using HTML program and using applet viewer tool. Using HTML program: In order to run the applet through HTML program we must use the following tag. File name: Using appletviewer: Appletviewer is a tool supplied by SUN micro system to run the applet programs from the command prompt in the case of browser is not supporting. When we use appletviewer to run the above applet, MyApp. Write an applet program which displays AshaKrishna My Love?
Applet; public class MyApp extends Applet. To set the font we must use a class called Font. Graphics public void setFont Font fobj. Write a JAVA program which illustrates the life cycle methods of applet? BOLD, 40 ; g.
A standalone GUI application is one which runs in the context of local disk and our class must extends a predefined class called java. Frame class. A distributed GUI application is one wh which ich runs in the context of browser and our class must extend java.
Applet class. As a part of GUI applications we use to create two types of components. They are passive components and active components. A passive component is one where there is no interaction from the user. For example label. An active component is one where there is an interaction from the user. For example button, check box, scroll bar, etc. The active and passive components in JAVA are available in terms of classes. In order to deal with any GUI applications we must import a package called java.
Whenever we develop any GUI application we must have readily available window component and window component must contain frame component. Any GUI component which we want to create gives the corresponding class and adds all those components to the object of Container class. A Container is a class whose object allows us to add n number of similar or different GUI components to make a final application.
Except Object class and Applet class all the classes in the a above bove hierarchy chart are belongs to java. The methods in line numbers 1 and 2 defined in java. Window class.
The methods in line numbers 3, 4 and 5 are defined in java. Component class. Label class: Label is a class which is used for creating label as a part of windows application. The component label comes under passive component. Labels always improve the functionali functionality and readability of active components.
Creating a label is nothing but creating an object of label components. Label class API: Data members: The above three statements are called alignment parameters or modifiers. Label Label String Label String label name, int alignment modifier. Instance methods: For example we can write a program as follows: RIGHT ;.
Event Delegation Model: Whenever we want to develop any windows applications one must deal with event delegation model. Event delegation model contains four properties. In order to process any active components, we must know either name or caption or label or reference of the component object.
Whenever we interact any active component, the corresponding active component will have one predefined Event class, whose object will be created and that object contains two details: Name of the component. Reference of the component. The general form of every Event class is xxx event. Component name print choice textField textArea scrollbar.
Event name java. ActionEvent java. ItemEvent java. TextEvent java. In order to perform any action or operation when an interactive component is interacted we must write some set of statements into the appropriate methods. These methods are not defined or. In JAVA purely undefined methods are abstract methods present in interfaces. Interfaces in awt are called listeners. Hence, every interactive component must have a predefined listener whose general notation is xxx listener.
Listener name java. ActionListener java. ItemListener java. TextListener java. Identity what is the undefined method or abstract method in xxx Listener. Undefined method name public public public public void void void void actionPerformed actionPerformed actionPerformed actionPerformed java. Each and every interactive component must be registered and unregistered with particular event and Listener. The general form of registration and un-registration methods is as follows: Button is an active component which is used to perform some operations such as saving the details into the database, deleting the details from the database, etc.
Creating a button is nothing but creating an object of Button class. Button API: Button ; Button String ;.
Write a java program to illustrate the concept of buttons? Steps for developing awt program: Import the appropriate packages. Choose the appropriate class and it must extend java. Frame and implements appropriate Listener if required. Identify which components we want and declare them as data members in the class. Set the title for the window. Set the size of the window. Create the components which are identified in step 3. Add the created components to container.
Register the events of the appropriate interactive component with appropriate Listener.
Make the components to be visible. Define the undefined methods in the current class which is coming from appropriate Listener. This method provides functionality to GUI component. Rewrite the above program using applets? Applet; import java. Import appropriate packages for GUI components java. Every user defined class must extend either Frame or Applet and it must implement appropriate Listener if required.
Identify which components are required to develop a GUI application. Use life cycle methods init, start, destroy in the case of applet, use default Constructor in the case of Frame for creating the components, adding the components, registering the components, etc. Set the title of the window. Set the layout if required. Create those components which are identified. Every interactive component must be registered with appropriate Listener. Make the components to be visible in the case of Frame only.
Implement or define the abstract method which is coming from appropriate Listener. Choice is the GUI component which allows us to add n number of items. This component allows selecting a single item at a time.
Creating a choice component is nothing but creating an object of Choice class. Choice API: Methods 1 and 2 are used for adding items to the choice component at end. Methods 3 and 4 are used for adding the items at the specified position.
Page Methods 5 and 6 are used for obtaining the items either based on its name or on its index. Methods 7 and 8 are used for removing the item of the choice component either based on its name or on its index position. Method 9 is used for removing all the items of choice components. Methods 10 and 11 are used for registering and unregistering the events of choice components.
Write a java program which illustrates the concept of Choice? Checkbox is basically used for maintaining checklist purpose checkbox is an interactive component which contains a square symbol and a label.
Creating a checkbox is nothing but creating an object of checkbox class By Mr. Checkbox API: Write a java program which illustrates the concept of Checkbox? Steps for converting checkboxes into radio button: Create objects of CheckboxGroup class.
CheckboxGroup object allows to select a single checkbox among n number of checkboxes. Create n number of objects of Checkbox class. Decide which checkboxes are adding to which CheckboxGroup object. In order to add the checkboxes to the CheckboxGroup object, in Checkbox class we have the following method: Register the events of checkbox with ItemListener by using the following method: Instead of using a setCheckboxGroup method we can also used the following Constructor which is present in Checkbox class.
Write a java program which illustrates the concept of Radio Button? TextField is GUI interactive component which allows entering the data in single line. Whatever the data, we enter to text field, by default that data will be treated as string. If we are able to read the data of text field then that text field is known as editable or nonecho or normal text field.
If we are unable to read the data of the text field then that text field is known as echo text field and the character which is available is known as echo character.
Creating a text box is nothing but creating an object of TextField class. TextField API: Write a java program which illustrates the concept of TextField?
Write a java program to close the window of awt? Adapter class: It is one which contains null body definition for those methods which are inheriting from appropriate Listener. In the derived class implements WindowListener interface; it is mandatory for derived class to define all the methods even though the derived class is not required. If the derived class wants to define the required methods, it has to extend its corresponding adapter class called java.
WindowAdapter and this class contains null body definition for WindowListener interface methods. Therefore which our Listener interface contains more than one undefined method for that Listener interfaces we have the appropriate adapter class whose general notation is XXXAdapter.
TextArea is the GUI interactive component in which we can enter multiple lines of information such as addresses, remarks, achievements, etc. Creating a TextArea is nothing but creating an object of TextArea class. Whenever we create a TextArea component by default Scrollbars will be in invisible mode. Whenever number of rows are exceeding automatically we get vertical scrollbar whereas when number of columns are exceeding we get horizontal scrollbar. TextArea API: TextArea ; TextArea int rows, int cols ; TextArea int rows, int cols, int scroll visibility modifier ;.
Write a java program which illustrates the concept of TextArea? List is the GUI interactive component which allows to select either single or multiple items at a time. Creating List component is nothing but creating an object of List class. List API: List ; List int size ; List int size, boolean mode ;. When we want to select the items of the list with single click then we must register with ItemListener to select items of the list with double click then we must register with ActionListener.
Write a java program which illustrates the concept of List? Mouse operation: Mouse is the hardware component which always deals with user interactive with various active components.
On mouse we can perform two types of operations, they are basic operations and advanced operations. To deal with basic operations of mouse we must take an interface called MouseListener. This interface contains the following undefined methods: In order to perform the basic operations of the mouse we must have the following registration method which are present in component class.
To perform advanced operations of mouse we must use a predefined interface called MouseMotionListener and it contains the following methods: In order to deal with advanced operations we must have the following registration methods: Write a java program which illustrates the basic and advanced operations of mouse? BOLD, 60 ; g. Method 1 is used for setting the status of applet window and Method 2 is used for calling the paint method automatically for number of times.
Scrollbar is the GUI component which allows us to see invisible number of rows and invisible number of columns with vertical and horizontal scrollbars. Write a java program which illustrates the concept of Scrollbar? Generally, in JAVA programming we write two types of applications or programs. They are volatile or non-persistent program and non-volatile or persistent program. A volatile program is one whose result is always stored in main memory of the computer i.
Whatever the data which is stored in the main memory of the computer that data will be temporary i. A non-volatile program is one whose result is stored in secondary storage devices i. To store the data we have two approaches. They are using files and using database. If we store the data permanently in the form of a file, then the data of that file can be modified by any unauthorized user.
Hence, industry always recommends not storing the data in the files. Since, files do not provide any security. Hence, industry always recommends storing the data in the form of database. Since, most of the popular databases provide security in the form of user names and passwords.
In order to store the data permanently in the form of files we must use or import a package called java. A record is a collection of field values. A stream is a flow of data between primary memory and secondary memory either locally within the system or globally across the network or [A stream is a flow of bytes between primary memory and secondary memory either locally within the system or globally across the.
Types of operations or modes on files files: On files we perform two types of operations they are read mode and write mode. The following diagram will illustrate how to open the file either in read mode or in write mode or in both modes: Types of streams in JAVA: Based on transferring the data between primary memory to secondary memory and secondary memory to primary memory.
In JAVA we have two types of streams they are byte streams and char streams. Byte streams are those in which the data will be transferred one byte at a time between primary memory to secondary memory and secondary memory to primary memory either locally or globally. Hierarchy chart for byte streams:.
InputStream class: This is an abstract class; hence we cannot create an object of this class directly. This class is basically used to open the file in read mode. In this class we have the following methods: OutputStream class: This is also an abstract class; hence we cann cannot ot create an object of this class directly.
This class is used for opening the file in write mode. FileInputStream class: This is the concrete which we can create an object or it contains all defined methods subclass of all InputStream class. This class is always used to open the file in read mode. Opening the file in read mode is nothing but creating an object of FileInputStream class. If the file name abc. FileOutputStream class: This is the concrete sub-class of all OutputStream classes.
This class is always used for opening the file in write mode is nothing but creating an object of FileOutputStream class. FileOutputStream String fname ; 2. FileOutputStream String fname, boolean flag ;.
If the flag is true the data will be appended to the existing file else if flag is false the data will be overlapped with the existing file data. If the file is opened in write mode then the object of FileOutputStream will point to that file which is opened in write mode. If the file is unable to open in write mode an object of FileOutputStream contains null.
Write the following JAVA programs: DataInputStream class: This is used for two purposes. They are reading the data from input device like keyboard and reading the data from remote machine like server. In order to perform the above operations we must create an object of DataInputStream class. DataInputStream InputStream ;. An object of InputStream called in is created as a static data member in System class. DataOutputStream class: This is used for displaying the data onto the console and also used for writing the data to remote machine.
DataOutputStream OutputStream ;. Old methods: New methods: Write a JAVA program to read two numbers from keyboard and display their product using older methods? Implement copy command of DOS? Implement type command of DOS? K v rao sir is the best teacher for java language we are providing full tutorials on java on www. K V Rao sir. Sir i need advance java notes pdf so can you please send it to me on my gmail id lalitiwari gmail.
Or any best reference websites url to learn advance java. KV Rao sir teaches neat and clear each and every point and also get the 10th class boy also. I had knowledge in java,but when i joined to KV Rao class,the programming skills becomes dead easy like left hand left finger KV Rao sir teaches core java very well even we dont have any knowledge of oops concepts sir will give clear idea about core java.
I am one of the student of K V Rao sir so i am very lucky to learned core java. Sir way of teaching is very good Min 4 months it will take. But you will come to know each and every concept. I want sir's Advance java notes also.. Ramakrishna Gaddam December 5, at 7: