Home > Back-end > Java applet in the small program uninitialized
Java applet in the small program uninitialized
Time:09-27
Package cn. Itcast. Day04. Homework;
import javax.swing.*; . Import the Java applet. The applet; import java.awt.*;
Public class text extends JApplet { Public void init () { JTextArea outputArea=new JTextArea (2, 20); The Container c=getContentPane (); C.a. dd (outputArea); OutputArea. SetText ( "The square of The integer is 7" + square (7) + "\ nThe Square of double 7.5 is" + Square (7.5));
} Public int square (int x) { Return (x * x); } Public double square (double y) { Return * y y; } } This is the source code
This is the HTML file & lt; html> & lt; The applet code="test. Class" width=800 height=600 & gt; & lt;/applet> & lt;/html>
Small program can open, but shows an uninitialized applet Can't find the test shown in the CMD. Java HTML documents and Java are together Why don't show come out?
If I put in the code package that line to delete, can run normally, Why is this?
CodePudding user response:
text class you wrote is this what you call is test watch carefully