Category Archive for: I/O Applets And Other Topics

Introducing Methods

Introducing Methods As mentioned at the beginning of this chapter, classes usually consist of two things: instance variables and methods. The topic of methods is a large one because Java gives, them so much power and flexibility. In fact, much of the next chapter is devoted to . methods. However, there are some fundamentals that you need to…

Read More →

The Complete Reference

The Complete Reference ThiS chapter continues our discussion of java.util by examining those classes and interfaces that are not part of the collections framework. These include classes that tokenize strings, work with dates, compute random numbers, and observe . events. Also, the java.util.ztp and java.util.jar packages are briefly mentioned at the end of this chapter. Stringtokenizer The processing of text…

Read More →

Native Methods

Native Methods Although it is rare, occasionally, you may want to call a subroutine that is written in a language other than Java. Typically, such a subroutine exists as executable code for the CPU and environment in which You are working-s-that is, native code. For example, you may want to call a native code subroutine to achieve faster…

Read More →

Using instance of

Using instance of  Sometimes, knowing the type of an object during run time is useful. For example, you ‘might have one thread of execution that generates various types of objects, and another thread that processes these objects. In this situation, it might be useful for the processing thread to know the type of each object when it receives…

Read More →

The transient Nonvolatile Vitrifaction Modifiers

The transient  Nonvolatile Vitrifaction  Modifiers Java defines two interesting type modifiers: transient and volatile. These modifiers are’ used to handle somewhat specialized situations. When an instance variable is declared as transient, then its value need not persist when an object is stored. For example: How if an object of type T ts written to a persistent storage area, the contents…

Read More →

Applet Fundamentals

Applet Fundamentals   All of the preceding examples in this book have been Java applications. However, applications constitute only one class of Java programs. The other type of program is the applet. As mentioned in Chapter 1, applets arc small applications that are accessed on an Internet server, transported over the Internet, automatically installed, and run as part of…

Read More →

Reading and writing Files

Reading and writing Files  Java provides a number of classes and methods that allow you to read and write files, In Java, all files are byte-oriented, and Java provides methods to read and write bytes from and to a file. However, Java allows you to wrap a byte-oriented file stream within. a character-based object. This technique is described…

Read More →

The Print Writer Class

The Print Writer Class  Although using System.out to write to the console is still permissible under Java, its use is recommended mostly for debugging purposes or for sample programs, such as those found in this book . For real-world programs, the recommended method of writing to the console-when using Java is through a Print Writer…

Read More →

Writing of sole Output

Writing of sole Output  Console output is most easily accomplished with print( ) and print in( ), described earlier, which are used in most of the examples in this book. These methods are defined by the class Print Stream (which is the type of the object referenced by System.out). Even though System,out is a byte stream,…

Read More →

Reading Strings

Reading Strings To read a string from the keyboard, use the version of read Line( ) that is a member of the Buffered Spreader. Its general form is shown here: String read Line ( ) throws IO Exception As you can see, it returns a String object. The following program demonstrates Butterfingered and the read line ) method;’ the program…

Read More →

Back to Top