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
asp.net vb.net render html to component
difference between AD integrated dns server and dns server
Java SAX
Outlook 2007 w/ Exchange 2010 empty folder
Quic Find/ Replace does not work in Microsoft Visual Studio 2008
VB.NET: problem of debugging on windows 7
jar encryption
"Another installation in progress..." MSI Installer Issue in Windows Vista
Windows 7 imaging???
first time-Only: internet explorer cannot open the internet site operation failed