Posts

Click Here To View Contents

Home Page Java Fundamentals Object Oriented Programming Part-1 Object Oriented Programming Part-2 String Handling & Wrapper Classes Exception Handling Java Streams & Serialization Network Programming Collections Framwork & Generics Multithreading & Synchronization New Features From JDK 1.1 to JDK 25

Java Streams & Serialization

Java Streams: A stream is a flow of data from source to destination. A source can be a keyboard, file, client, server, ... etc., A destination can be a monitor, file, client, server, .. etc., In Java, streams are divided into 3 categories: 1) Console Input/Output Streams 2) File Input/Output Streams 3) Network Input/Output Streams Predefined Streams: There are 3 predefined streams 1) in 2) out 3) err "in" is an object reference of java.io. InputStream class "out" & "err" are object reference of java.io.PrintStream  class. The above all predefined streams are static members of java.lang.System class. Differences between System.out & System.err System.out                                System.err 1) It is used to display           1) It is used to display       output messages.              ...

New Features

JDK 1.7 Features: 1) Strings in switch statement 2) try with resource statement 3) Handling multiple exceptions with single catch block 4) Generics type inference 1) Strings in switch statement: This feature allows to write strings in a switch statement. Example: class Demo {       public static void main(String args[])       {              switch(args[0])              {                     case "mon": System.out.println("Monday");                                           break;                     case "tue": System.out.println("Tuesday");                                    ...