home account info subscribe login search My ITKnowledge FAQ/help site map contact us


 
Brief Full
 Advanced
      Search
 Search Tips
To access the contents, click the chapter and section titles.

Sams Teach Yourself Visual J++ 6 in 21 Days
(Publisher: Macmillan Computer Publishing)
Author(s): Rick Leinecker
ISBN: 0672313510
Publication Date: 11/01/98

Bookmark It

Search this book:
 
Previous Table of Contents Next


Q&A

Q What’s the difference between Java and JavaScript?

A They’re two different animals. Although their names sound the same, the languages themselves are quite dissimilar. JavaScript is more like VBScript than Java, and Java is more like C++ than JavaScript.

Q What kind of World Wide Web limitations sparked the creation of the Java language?

A HTML is essentially static. The pages that made up the bulk of the World Wide Web are still images and text. Java was seen as a way to easily add dynamic content to the Web.

Q How do I create a Java applet with Visual J++?

A The first thing you’ll need to do is make sure that the New Projects dialog box is opened. This should automatically happen when you first run Visual J++ (unless you have your options set to load the previous solution at startup). If Visual J++ is already running, you can simply select File, New Project.

Q How can I change the text that appears by default in applets?

A Just open the HTML source code. Find the parameter with the name of label (name=label) and a value of “This string was passed from the HTML host.” (value=”This string was passed from the HTML host.”). Edit the value string so that it contains the text you’d like displayed.

Q Do I need to recompile when I change the HTML code?

A No. The HTML code is interpreted. That means the latest HTML code is read in and used. Applet code, on the other hand, is different. Java classes must be compiled. The compilation process converts the .java source code to what’s known as byte code. Byte code is what interpreters such as Internet Explorer load in and execute. If you don’t compile after a change to your .java source code, the source code is different, but not the byte code.

Q What’s the difference between a Java applet and a Java application?

A A Java applet is byte code that’s interpreted by something such as Internet Explorer. Applets are usually embedded in HTML pages and executed when browsers hit the pages. Java applications are collections of byte code that are wrapped in an .EXE file. The .EXE file runs a special program that causes the byte code to be interpreted by the Java Virtual Machine. Java applications can’t be deployed in Web pages.

Q I don’t know anything about programming. Can I expect to learn how to program with Visual J++ by reading this book?

A The first thing you might consider doing is getting a copy of Teach Yourself Java 1.2 in 21 Days (also published by Macmillan). This book systematically teaches all the concepts and techniques you need to know to program with Visual J++. If you conscientiously work your way through the book without skipping anything, you’ll have a good basis for your Visual J++ programming. You will, however, be much better off if at the end of each chapter you spend some time experimenting with what you learned in the chapter.

Q I know a lot about HTML programming. Will that help me write with Visual J++?

A Any programming experience will help because many concepts carry over. Visual J++ is much more difficult than HTML, though, so don’t expect it to be a cakewalk. Once again, if you’re patient and work through this book systematically, you’ll have very little trouble learning how to program with Visual J++.

Review Exercises

1.  Create an applet with Visual J++. Change the message so that it says This is an applet created with Visual J++. Then change the size of the applet window that appears in the browser by editing the width and height parameters in the .htm file. Compile and run the applet.
2.  Create an application with Visual J++. Add a label that says This is an application created with Visual J++. Add a second label that says I like Visual J++. Compile and run the application.


Previous Table of Contents Next


Products |  Contact Us |  About Us |  Privacy  |  Ad Info  |  Home

Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc.
All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement.