Crenox

Teach Yourself Java in 21 Days NOTES

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