Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Teach Yourself Java in 21 Days NOTES:
- DAY 1:
- ------------------------------------------------------------------------------------------------------------------
- Enter Java, and the capability for Web pages of containing Java applets. Applets are small
- programs that create animations, multimedia presentations, real-time (video) games, multi-user
- networked games, and real interactivity—in fact, most anything a small program can do, Java
- applets can. Downloaded over the net and executed inside a Web page by a browser that supports
- Java, applets are an enormous step beyond standard Web design.
- An applet is a dynamic and interactive program that can run inside a Web page displayed
- by a Java-capable browser such as HotJava or Netscape 2.0.
- Java is an object-oriented programming language developed by Sun Microsystems, a company
- best known for its high-end Unix workstations. Modeled after C++, the Java language was
- designed to be small, simple, and portable across platforms and operating systems, both at the
- source and at the binary level (more about this later).
- Java is often mentioned in the same breath as HotJava, a World Wide Web browser from Sun
- like Netscape or Mosaic (see Figure 1.1). What makes HotJava different from most other
- browsers is that, in addition to all its basic Web features, it can also download and play applets
- on the reader’s system. Applets appear in a Web page much in the same way as images do, but
- unlike images, applets are dynamic and interactive. Applets can be used to create animations,
- figures, or areas that can respond to input from the reader, games, or other interactive effects on
- the same Web pages among the text and graphics.
- Although HotJava was the first World Wide Web browser to be able to play Java applets, Java
- support is rapidly becoming available in other browsers. Netscape 2.0 provides support for Java
- applets, and other browser developers have also announced support for Java in forthcoming
- products.
- Platform independence is one of the most significant advantages that Java has over other
- programming languages, particularly for systems that need to work on many different platforms.
- Java is platform-independent at both the source and the binary level.
- Platform-independence is a program’s capability of moving easily from one computer
- system to another.
- At the source level, Java’s primitive data types have consistent sizes across all development
- platforms. Java’s foundation class libraries make it easy to write code that can be moved from
- platform to platform without the need to rewrite it to work with that platform.
- Platform-independence doesn’t stop at the source level, however. Java binary files are also
- platform-independent and can run on multiple problems without the need to recompile the
- source. How does this work? Java binary files are actually in a form called bytecodes.
- Bytecodes are a set of instructions that looks a lot like some machine codes, but that is not
- specific to any one processor.
- Normally, when you compile a program written in C or in most other languages, the compiler
- translates your program into machine codes or processor instructions. Those instructions are
- specific to the processor your computer is running—so, for example, if you compile your code
- on a Pentium system, the resulting program will run only on other Pentium systems. If you want
- to use the same program on another system, you have to go back to your original source, get a
- compiler for that system, and recompile your code.
- Java applications fall into two main groups: applets and applications.
- Applets, as you have learned, are Java programs that are downloaded over the World Wide Web
- and executed by a Web browser on the reader’s machine. Applets depend on a Java-capable
- browser in order to run (although they can also be viewed using a tool called the appletviewer,
- which you’ll learn about later today).
- Java applications are more general programs written in the Java language. Java applications don’t
- require a browser to run, and in fact, Java can be used to create most other kinds of applications
- that you would normally use a more conventional programming language to create. HotJava
- itself is a Java application.
- The paint() method displays the content of the applet to the screen.
- ------------------------------------------------------------------------------------------------------------------
- DAY 2:
- ------------------------------------------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment