java - A calendar starts on a Monday and returns a 1 to an int weekDay and my code should should do that -
a calendar starts on monday , returns 1 int weekday , code should that. can't figure out next next since tried, got errors
import java.applet.applet; import java.util.*; import java.awt.*; public class dates2applet extends applet { public static void main(string[] args) { calendar c = calendar.getinstance(); int wday = c.get (calendar.day_of_week); if(calendar.monday == c.getfirstdayofweek()); { system.out.println("monday first day of week"); } if(calendar.monday == c.get(calendar.day_of_week)); { system.out.println("monday close books"); } if(calendar.day_of_week == c.get(calendar.day_of_week)); { system.out.println("normal week day"); } if(calendar.saturday ==0 || calendar.sunday ==0); { system.out.println("match day"); } }
when put semicolon @ end of if
statements creates 1 line body, , braces not tied if
(and that's why, presumably. else
didn't work you) - think wanted like,
if(calendar.monday == c.getfirstdayofweek()) { system.out.println("monday first day of week"); } if(calendar.monday == c.get(calendar.day_of_week)) { system.out.println("monday close books"); } else if(calendar.day_of_week == c.get(calendar.day_of_week)) { system.out.println("normal week day"); } else if(calendar.saturday ==0 || calendar.sunday ==0) { system.out.println("match day"); }
Comments
Post a Comment