Microsoft
Software
Hardware
Network
Question : method with parameter
Hi,
I ran following program.
public class Class4
{
public static void main( String args[] )
{
GradeBook4 myGradeBook = new GradeBook4();
String courseName = "Java ";
myGradeBook.displayMessage
( courseName );
}
}
class GradeBook4
{
public void displayMessage( String courseName )
{
System.out.printf( "Welcome to the grade book for\n%s!\n",
courseName );
}
}
got output as
Welcome to the grade book for
Java !
My question is
how we got this output. Usually i concatenate the string message with + operator to display declared variables etc.
I also not clear where from ! is getting printed in output. Any links, ideas, sample code highly apppreciated. Thanks in advance
Answer : method with parameter
>>when i give like
System.out.printf( "Welcome to the grade book for\n%s!\n"+courseName );
>>
because it's expecting a parameter, which you're not giving it. See aforementioned docs
Random Solutions
Cisco 851 router installation blocks XP File and Print Services functionality for attached client PC's.
Need a random list of 1000 geocoded locations in any one country
Displaying GroupWise contacts in Exchange address book?
How to fix windows xp service pack 3 install error: "The system cannot find the file specified"
publishing websites in TMG 2010
Replace line from keyword
Does safari support sftp native?
Exchange 2007 - Delivery is delayed to these recipients or distribution lists:
Capture Linkbutton click event in Master page from Content page
Curl API , XML parsing problem ?