Console I/O in Java 2

Files and File I/O:- The Java technology includes a rich set of I/O streams which are described in the previous section. In this it examines several simple technologies for reading and writing to files with a focus on the character data, including: Creating File Objects Manipulating File Objects Reading and Writing to file streams Creating a New File Object:- The File class provides several utilities for handling files and obtaining information about them. In java technology, a directory is just another file. We can create a File object that represents a directory and…Read more

Readers-Writers & Dinning philosophers Problem

The Readers-Writers Problem Suppose that a database is to be shared among several concurrently running processes. Some of these processes may want to only read the database, whereas others may want to update (that is, to read and write) the database. We distinguish between these two types of processes by referring to the former as readers and to the latter as writers. Obviously, if two readers access the shared data simultaneously no adverse effects on the result. If a writer and some other process (either a reader or a writer) access the database…Read more

Console I/O in Java

Console I/O:- Most application must interact with the user. Such interaction is sometimes accomplished with text input and output to the console (using the keyboard as the standard input and using the terminal window as the standard output). Java JDK supports console I/O with three public static variables on the java.lang.System class: The variable System.out is a PrintStream object that refers (initially) to the terminal window that launched the Java technology application. The variable is an InputStream object that refers (initially) to the user’s keyboard. The variable System.err is a PrintStream object…Read more

Ordering Collections in JAVA 2

Last time we have discussed the Comparable interface and now we are going to see how the Comparator interface works. Comparator interface:- The Comparator interface provides greater flexibility with ordering. For example, if you consider the Student class described previously, the sorting of Students was restricted to sorting on GPA’s. It was not possible to sort the student based on first name or some other criteria. So now we are going to see how sorting flexibility can be enhanced using the Comparator interface. The Comparator interface is a java.util package member. It is…Read more

Ordering Collections in JAVA : Part 1

Ordering Collections:- • The comparable interface and comparator interface are the interfaces which are used for the Ordering Collection. • The Comparable interface imparts natural ordering to the classes which implement it. • The Comparator interface is used to specify the order relation. It can also be used to override the natural ordering. • Both the interfaces, Comparable interface and Comparator interface are useful to sorting elements in a collection. The Comparable interface:- • The Comparable interface is a member of a java.lang package. • A class which implements a Comparable interface having…Read more

Input-Output Fundamentals in JAVA 5

Serialization:- Saving the object to some type of permanent storage is called as persistence. An object is said to be persistent capable when you can store that object on a disk or a tape or send it to another machine to be stored in memory or on disk. The non persisted object exists only as long as the Java Virtual Machine is running. The Serialization is a mechanism for saving the objects as a sequence of bytes and later, when needed, rebuilding the byte sequence back into a copy of the object. For…Read more

I/O Fundamentals in JAVA 4

I/O Stream Chaining:- A program rarely uses a single stream. Instead, it chains a series of streams together to process the data. The given below demonstrates an example input stream; in this case, a file stream is buffered for efficiency and then converted into data (Java primitives) items. This is an input stream chain example Data Source è FileInputStream => BufferedInputStream => DataInputStream è Program And given below demonstrates an example output stream; in this case, data is written, then buffered, and finally written to a file. This is an input stream chain…Read more

How Can You Heal the Internet?

­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­ARE YOU FRIGHTENED OF VIRUSES!!!!!!!!! GET A REMEDY…. What do you think happens when you connect your computer to the Internet? In less than an hour, it may not be yours anymore. While you're Goggling your name and checking e-mail, a hacker, perhaps in Eastern Europe-let's call him Paji-quietly takes over your machine. There are a dozen ways Paji could do it, but he probably found you with a program he didn't get at Best Buy called a port scanner, which roams the Internet like a clumsy cat burglar, trying every doorknob until…Read more

What about theory of AI?

     Inquire about in AI used to envelop two sides: a down to earth side concerned with building capable programming that re-makes a portion of the brain's issue comprehending capacities, and a hypothetical side, where programming and thoughts from figuring are utilized as devices to help grasp the psyche. AI's viable side presses on to flourish, however its hypothetical side has moped in the wake of handing down a mixture of splendid and abominable thoughts to logic and cognitive brain research. This aspect of AI examination has give or take closed down…Read more

I/O Fundamentals in JAVA 3

Node Stream:- In the java JDK, there are three fundamental types of nodes, Files Memory (such a arrays or String objects) Pipes (a channel from one process or thread [a light-weight process] to another; the output pipe stream of one thread is attached to the input pipe stream of another thread) It is possible to create new node stream classes, but it requires handling native function calls to device driver, and this is non portable. Below shows the node streams: Type Character Streams Byte Streams File FileReader FileInputStream   FileWriter FileOutputStream Memory Array…Read more