Results 1 to 6 of 6
Thread: Need help with some questions
- 11-23-2010, 09:55 AM #1
Member
- Join Date
- Nov 2010
- Posts
- 4
- Rep Power
- 0
Need help with some questions
Problem Set 1A
1. The sample programs for Unit 1. If you have not already done so, copy from the shared drive the sample programs Welcome1.java, WelcomeDialog1.java, WelcomeDialog2.java, HealthWarning.java. Open them in JCreator, compile and run each one, then answer the following questions:
(i) What object is being used for output in Welcome1.java? Welcome to OOP2
(ii) What method is being called / invoked on it? Scanner
(iii) What is the name of the method being used for output in WelcomeDialog1.java? System.out.Print
(iv) This is a ‘static’ method, ie no object is needed for it: in what class is its definition?
(v) How many arguments are passed to the output method in WelcomeDialog1?
(vi) Run HealthWarning.java. In what way is the output different from the output from WelcomeDialog1?
(vii) Examine the code for HealthWarning: how many arguments are passed to the output method?
this is the code:
public class Welcome1 {
/** Displays a welcome message */
public static void main( String args[] ) {
System.out.println( "Welcome to OOP2" );
}
}Last edited by El_Davidos; 11-23-2010 at 09:58 AM. Reason: incomplete
- 11-23-2010, 09:57 AM #2
Member
- Join Date
- Nov 2010
- Posts
- 4
- Rep Power
- 0
when this is the example:
public class Welcome1 {
/** Displays a welcome message */
public static void main( String args[] ) {
System.out.println( "Welcome to OOP2" );
}
}
-
Welcome to the forum. So you've posted your homework assignment without actually asking a question, and it always confuses me what to do in this situation. Certainly you don't want someone to just post the answers for you to copy and hand in as that would be cheating, but I still have to wonder, just what do you want? Please help clarify this by showing us your attempted answers to these questions and any specific questions you may have regarding your answers.
- 11-23-2010, 10:07 AM #4
Member
- Join Date
- Nov 2010
- Posts
- 4
- Rep Power
- 0
alright so never mind Q4. these are my answers:
(i) What object is being used for output in Welcome1.java? System.out.print
(ii) What method is being called / invoked on it?
(iii) What is the name of the method being used for output in WelcomeDialog1.java?
(iv) This is a ‘static’ method, ie no object is needed for it: in what class is its definition?
(v) How many arguments are passed to the output method in WelcomeDialog1? 1
(vi) Run HealthWarning.java. In what way is the output different from the output from WelcomeDialog1? The output screen has a header in this example, “Health Warning”
- 11-23-2010, 10:13 AM #5
Member
- Join Date
- Nov 2010
- Posts
- 4
- Rep Power
- 0
actually i got it sorted. was a bit confused for a bit cos of way questions looked
-
I'm not seeing answers for many of your questions above. And we haven't seen the code for WelcomeDialog1 yet.
The answer for (i) though were I do see an attempt is: System.out, a PrintStream object.
Similar Threads
-
Three questions
By an24 in forum JavaServer Faces (JSF)Replies: 0Last Post: 09-15-2010, 08:36 AM -
Some Questions
By MuslimCoder in forum New To JavaReplies: 2Last Post: 02-25-2009, 04:01 PM -
I have Questions -_-
By ChazZeromus in forum New To JavaReplies: 5Last Post: 09-13-2008, 08:08 PM -
Questions About JSP?
By mtz1406 in forum JavaServer Pages (JSP) and JSTLReplies: 2Last Post: 08-19-2008, 07:56 PM -
Just a Few Questions
By pringle in forum New To JavaReplies: 21Last Post: 01-09-2008, 06:21 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks