. . .

Category: Java

What is Transient Keyword?

Please share the article
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

Please share the article          When an object that can be serialized, you have to consider whether all the instance variables of the object will be saved or not. Sometimes you have some objects or sub-objects which carry sensitive information like password. If you serialize such objects even if information (sensitive information) is private in that object […]

What is object serialization?

Please share the article
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

Please share the article          It takes all the data attributes, writes them out as an object, and reads them back in as an object. For an object to be saved to a disk file it needs to be converted to a serial form. An object can be used with streams by implementing the Serializable interface. The […]

Writing Files in java?

Please share the article
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

Please share the article          You can open a file output stream to which text can be written. For this use the FileWriter class. As always, it is best to buffer the output. The following code sets up a buffered file writer stream named outFile to write text into a file named output.txt. PrintWriter outFile = new […]

Reading Files in java?

Please share the article
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

Please share the article          Let’s begin with the FileReader class. As with keyboard input, it is most efficient to work through the BufferedReader class. If an input is text to be read from a file, let us say “input.txt,” it is opened as a file input stream as follows: BufferedReader inputFile=new BufferedReader(new FileReader(“input.txt”)); The line above […]

Reading From & Writing To, Console?

Please share the article
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

Please share the article          Reading Console Input Java takes input from the console by reading from System.in. It can be associated with these sources with the reader and sink objects by wrapping them in a reader object. For System.in an InputStreamReader is appropriate. This can be further wrapped in a BufferedReader as given below if a […]

File Input & Output Stream classes in Java?

Please share the article
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

Please share the article          Most of the functionality available for byte streams are also provided for character streams. The methods for character streams generally accept parameters of data type char, while byte streams work with byte data types. The names of the methods in both sets of classes are almost identical except for the suffix, that […]

Synchronisation In Java

Please share the article
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

Please share the article          If you want two threads to communicate and share a complicated data structure, such as a linked list or graph, you need some way to ensure that they don’t conflict with each other. In other words, you must prevent one thread from writing data while another thread is in the middle of […]

Java Thread Model?

Please share the article
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

Please share the article          The benefit of Java’s multithreading is that a thread can pause without stopping other parts of your program. A paused thread can restart. A thread will be referred to as dead when the processing of the thread is completed. After a thread reaches the dead state, then it is not possible to […]

What is a Multithreading in Java?

Please share the article
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

Please share the article          Multithreaded programs support more than one concurrent thread of execution. This means they are able to simultaneously execute multiple sequences of instructions. Each instruction sequence has its own unique flow of control that is independent of all others. These independently executed instruction sequences are known as threads. Your PC has only a […]

What is constructor in java?

Please share the article
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

Please share the article          Constructors A constructor initializes an object with its creation. It has the same name as the name of its class. Once a constructor is defined, it is automatically called immediately the memory is allocated before the new operation completes. A constructor does not have any return type, its implicit return type is […]