Results 1 to 2 of 2
Thread: Using printf without specifiers
- 10-17-2011, 03:38 AM #1
Member
- Join Date
- Oct 2011
- Posts
- 6
- Rep Power
- 0
Using printf without specifiers
1st post here as a member on this forums, so pardon me if somethings wrong with my post or offensive to anyone. But below is my code for my HW assignment due in a little while.
My question is how do I go about using the printf method without specifiers??
Also if someone would be helpful enough to just take a quick look at my code just to make sure everythings good (For some reason I keep getting a unclosed string literal at the System.out.printf and as well as a ")" expected at the increment ++months) I'd really appreciate it. Thanks.
Java Code:/* * *Code a do/while loop that only prints the name of the month from September through November or it issues a *"Month not found!" error message. Use if/else statements. A variable called month has been declared and *initialized to 9. Use printf() without specifiers. Code using Notepad. * Save as YourLastNameFirstInitialDoWhileHW.txt * * */ public class doWhileLoopHW { public static void main ( String[] args) { int months = 9; do { System.out.printf( "%d , months ); ++months; } while ( months <= 2); //END do...while if ( months >= 3) { System.out.println( "Month not found!" ); } else System.out.printf( "%d" , months ); }//END Main }//END Class doWhileLoopHWLast edited by JosAH; 10-17-2011 at 08:58 AM. Reason: added [code] ... [/code] tags
- 10-17-2011, 08:46 AM #2
Senior Member
- Join Date
- Oct 2010
- Location
- Germany
- Posts
- 780
- Rep Power
- 4
Similar Threads
-
Access Specifiers
By maheshpwr in forum New To JavaReplies: 7Last Post: 03-17-2011, 09:54 AM -
printf
By razzle in forum New To JavaReplies: 4Last Post: 11-12-2010, 02:13 PM -
Format Specifiers
By Cass29 in forum New To JavaReplies: 3Last Post: 12-20-2009, 03:49 PM -
Printf error
By ks1615 in forum New To JavaReplies: 4Last Post: 03-10-2009, 06:59 AM -
printf
By Jack in forum New To JavaReplies: 2Last Post: 07-04-2007, 04:31 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks