-
Why do I have to use -d to compile?
Here I have a file named Hello1.java but when i compile it, it generates a message. So, I compile it again with -d.
javac -d Hello1.java
Why do i have to use '-d'?
Is there any other ways to compile the file?
-------------Hello1.java-------------
import java.awt.Frame;
import java.awt.FlowLayout;
import java.awt.Label;
public class Hello1 extends Frame
{
private String message = "";
private Label messageLabel = new Label("Message Text");
public static void main(String args[])
{
Hello1 me = new Hello1("Hello World");
me.printMessage(args[0]);
}
public Hello1(String message)
{
this.message = message;
setLayout(new FlowLayout());
add(messageLabel);
resize (200, 50);
show();
}
private void printMessage(String messageType)
{
GeneralMessagePrinter newPrinter = null;
if (messageType.equals("l"))
newPrinter = new LowerCaseMessagePrinter(message);
else if (messageType.equals("u"))
newPrinter = new UpperCaseMessagePrinter(message);
messageLabel.setText(newPrinter.getMessage());
}
}
class GeneralMessagePrinter
{
private String message;
public GeneralMessagePrinter(String message)
{
this.message = message;
}
public String getMessage()
{
return (message);
}
}
class LowerCaseMessagePrinter extends GeneralMessagePrinter
{
public LowerCaseMessagePrinter(String message)
{
super(message.toLowerCase());
}
}
class UpperCaseMessagePrinter extends GeneralMessagePrinter
{
public UpperCaseMessagePrinter(String message)
{
super(message.toUpperCase());
}
}
-----------end of Hello1.java--------
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks