This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* StringDemo.java | |
* | |
* String Handling. | |
* - String is fixed and immutable class object. | |
* - Strings are stored in Java heap memory. | |
* - | |
* | |
* Usage: | |
* javac StringDemo.java && java StringDemo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* StringBufferDemo.java | |
* | |
* StringBuffer class Demo. | |
* | |
* A thread-safe, mutable sequence of characters. | |
* A string buffer is like a String, but can be modified. | |
* At any point in time it contains some particular sequence of characters, | |
* but the length and content of the sequence can be changed through certain method calls. | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* ExceptionDemo.java | |
* | |
* A process of responding to the occurrence, during computation | |
* – anomalous or exceptional events requiring special processing. | |
* | |
* Clauses of Exception Handling | |
* 1. try | |
* Program statements which raised exception should be returning try block. | |
* 2. catch |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* ArithmeticException Demo | |
* | |
* Notes: | |
* - A try block can have one or more catch blocks, or finally block. | |
* | |
* Usage: | |
* javac Excep1.java | |
* java Excep1 | |
* java Excep1 10 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* User Defined Exception Demo | |
* | |
* 1. Create a class by extending Exception class | |
* 2. Write a parameterized constructor. | |
* 3. Override the toString() method. | |
* | |
* Usage: | |
* javac UserExceptionDemo.java | |
* java UserExceptionDemo 2 10 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* UnreportedException Demo | |
* | |
* Usage: | |
* javac UnreportedExceptionDemo.java | |
* java UnreportedExceptionDemo | |
*/ | |
class UnreportedExceptionDemo { | |
public static void main(String[] args) throws ClassNotFoundException { | |
// public static void main(String[] args) { // error: unreported exception ClassNotFoundException; must be caught or declared to be thrown |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* File Handling Demo | |
* | |
* Is all about reading and writing activities over file system (java.io). | |
* Streams provide communication channels between communication participants. | |
* | |
* Type of stream classes: | |
* * Byte Stream classes: | |
* - do not support Unicode | |
* * Character Stream classes: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Serialization Demo | |
* | |
* Serialization is a process of writing a state of an object to a ByteString. | |
* Deserialization is a process of reading state of an object from a file. | |
* | |
* Notes: | |
* - Only objects of class which implements the serializable interface can be serialized. | |
* | |
* Usage: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* JDBC API Demo | |
* | |
* JDBC (Java Database Connectivity API) provides several classes and interfaces | |
* that enables java applications to communicate with the backend system. | |
* | |
* JDBC Architecture | |
* Java Application -> Driver Manager -> Available drivers (MySQL Driver, Oracle, SQL Server). | |
* | |
* All the java applications should follow the standard steps such as: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* JDBC API Demo 2 | |
* | |
* PreparedStatement is pre-compiled statement and activites include: | |
* - load the query | |
* - parse the query | |
* - execute the query | |
* - save the query | |
* | |
* Usage: |