Java Lab 1

Question 1: What are the main differences between Java and C++? 

	Java is interpreted. It is compiled into platform
	neutral byte-codes which are then interpreted on the
	machine that runs it. This is usually done with a Java
	Virtual Machine but some Just-In-Time compilers are now
	being used. This makes it very portable.

	C++ is compiled into machine dependant code which can
	not run on various platforms in the compiled form. It
	must be compiled specifically for each platform that it
	will run on. There are sometimes platform specific
	features that may require code changes to support each
	platform. This makes it less portable.

	Some other differences include:
	Java handles it own memory allocation.
	Java does not use Pointers to the same extent that C++ does. It
		eliminates pointer arithmetic and provides null pointer
		checking. This makes Java less complex.
	Both are OO but Java only supports classes. It does not support
		structures, etc.
	C++ allows multiple inheritance while Java only supports single
		inheritance.

Question 2: In what respect is C or C++ better than Java? 

	C and C++ programs are faster than Java due to it's interpretive
	nature. 

	Many people also believe that C/C++ is more fault tolerant and
	stable than Java. Consider the following warning that Microsoft
	has included with it's Java license.

	NOTE ON JAVA SUPPORT. THE SOFTWARE PRODUCT CONTAINS SUPPORT FOR 
	PROGRAMS WRITTEN IN JAVA. JAVA TECHNOLOGY IS NOT FAULT TOLERANT
	AND IS NOT DESIGNED, MANUFACTURED OR INTENDED FOR USE OR RESALE
	AS ONLINE CONTROL EQUIPMENT IN HAZARDOUS ENVIRONMENTS REQUIRING 
	FAIL-SAFE PERFORMANCE, SUCH AS IN THE OPERATION OF NUCLEAR 
	FACILITIES, AIRCRAFT NAVIGATION OR COMMUNICATIONS SYSTEMS, AIR 
	TRAFFIC CONTROL, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS,
	IN WHICH THE FAILURE OF JAVA TECHNOLOGY COULD LEAD DIRECTLY TO 
	DEATH, PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE.

Question 3: Why is Java perfectly suited for Internet programming? 

	Because it is an architectural-neutral language which makes it
	platform independent. This is important because there are many
	different types of computers (platforms) that are used throughout
	the Internet. They can all run the same Java programs which makes
	program development much easier.

Question 4: Install JDK. 

	Done. I have installed this on my PC where I am doing my 
	development. It is also available on the WPI machines.

Question 5: Let's look at the HelloWorld application again and try
            to compile and run it. 

	Done. Compiling the source gave be the *.class file.
	Running the file produced:

	g:\javalab1>java HelloWorldApp
	Hello World!

	g:\javalab1>
	

Question 6: Let's look at the HelloWorld applet again and try to 
            compile and run it. 

	Done. I was able to view the applet in the Netscape browser
	and via the appletviewer that comes with the JDK.