aspose file tools
The moose likes Beginning Java and the fly likes simple questions about AWT and Assertions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of RabbitMQ in Depth this week in the Open Source forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "simple questions about AWT and Assertions " Watch "simple questions about AWT and Assertions " New topic

simple questions about AWT and Assertions

Wenyu Deng

Joined: Mar 27, 2003
Posts: 6
Anybody can tell me, what is the full name of AWT and Assertions? and what are they mean? thanks a lot.
----waiting for your feeback.
Charles Lyons
Ranch Hand

Joined: Mar 27, 2003
Posts: 836
Correct me if I'm wrong, but AWT stands for Abstract Windowing Toolkit... All of the GUI components (e.g. windows and buttons) are designed to utilise native code, hence displaying like your normal windows under any OS (i.e. in Windows, they will display as normal Windows windows do [that phrase is confusing!], and under Linux they will display in a Linux-style format). Often now, many programmers use the Swing components (in package javax.swing), as they supply additional and improved components - and will always display the SAME across any platforms.
Assertions are used (as any concurrent programmer of J2SE 1.4 will tell you) to verify that certain statements that MUST BE TRUE are met, or that points in code that should never be reached are not... For example, suppose that you have a switch statement, and the int passed as the argument should match one of the cases exactly. You may use an assertion in the default case, to verify that if the code is reached, the program will terminate (as technically it should never be reached).
They may also be used to verify that a particular variable or method returns a value that MUST be correct.
Note that assertions are disabled by default, to enable backward compatibility with code that used variable names (identifiers more technically) called 'assert'. The structure of an assert statement is effectively:
assert <statement> : <message>;
If the <statement> returns the boolean value false, the program (assuming assertions enabled) will terminate, with an optional String message <message>. There are several APPROPRIATE uses of assertions, and uses which are NOT - certainly this is required information for the SCJP 1.4 exam.

Charles Lyons (SCJP 1.4, April 2003; SCJP 5, Dec 2006; SCWCD 1.4b, April 2004)
Author of OCEJWCD Study Companion for Oracle Exam 1Z0-899 (ISBN 0955160340 / Amazon Amazon UK )
Wenyu Deng

Joined: Mar 27, 2003
Posts: 6
thank you, i got it.
Dirk Schreckmann

Joined: Dec 10, 2001
Posts: 7023
Welcome to JavaRanch, Wenyu!
For more information on assertions in Java, take a look at the September 2002 JavaRanch Newsletter.

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
I agree. Here's the link:
subject: simple questions about AWT and Assertions