-
The scope of a variable defined by a Do-while loop statement body is constrained by the body of the statement.
Do
{
Int J = Integer.parseint (Stdin.readline ());
}while (J! = 6211954)//This is wrong, J can only be used in its defined statement body.
-
File operations
BufferedReader Filein = new BufferedReader (new FileReader (filename));
String currentlinet = Filein.readline (); The first line.
String nextline = Filein.readline (); The second line.
Filein.close ();
-
GI programming based on graphical user interface
GUI Graphical user interface
Containers and Components
-
Typical GUI-based programming in Java is the use of the Swing Application Interface (API). Event-driven programming.
JFrame represents a window with a name and border
JTextArea represents a component that can be compiled to enter multiple lines of text
JLabel represents the display area, which can display one or both lines of text and pictures
JTextField represents a component that can be compiled to enter a single-line file
JButton represents a button.
-
There are at least three ways to use a typical GUI-based programming. One is the main method, main (), where it defines an instance of a GUI. Creating this instance is done by firing the construction method, which creates and initializes the GUI artifacts. The construction method also registers the event listener, which is used to listen to any program's specific responses to user interaction. The third method is an action performer method, which is used to handle events of interest.
-
The GUI is a real object , and once constructed, the GUI has properties and behaviors. A property is an instance variable of a graphical component, and the behavior is the action taken by the GUI when the event occurs.
-
class Constants , which are constants that all objects in this class share access to.
-