Browsing 7239 questions and answers with Jon Skeet
You aren't marking the start and end the bodies of your if statements - wihch means they're just single statements. You've currently effectively got: if(opp==1) { c=riyal*0.267; } System.out.print(riyal+" Riyals is converted to "+c"... more 5/1/2015 9:07:25 AM
No, I don't believe there's a simple way you can do that. If you're in control of all the code, you could have a public version of Run2 with the constraint, but a private implementation of Run2 without the constraint, which you call from... more 5/1/2015 6:21:45 AM
If output.getPvalues() returns an array, you could use: double[] values = output.getPvalues(); for (int i = 0; i < values.length(); i++) { System.out.print(values[i]); if (i != values.length - 1) { ... more 5/1/2015 6:17:50 AM
Apparently you've called c.setAutoCommit(false) ... but then you haven't committed the update. So no, that won't have updated the database. Just use c.commit(); after the update - or turn auto-commit back on instead. If you were... more 5/1/2015 6:13:02 AM
You're calling char.ToLower - which is a static method accepting the relevant character as a parameter, and optionally a CultureInfo. So you probably want: y = char.ToUpper(letter); and y = char.ToLower(letter); Note that your loop... more 4/30/2015 7:30:41 PM
Just use String.valueOf(long) instead: String timeStampString = String.valueOf(System.currentTimeMillis() / 1000L); Unlike String.format, that will always format using "regular" digits '0' to '9'. more 4/30/2015 7:17:59 PM
Firstly, it sounds like you're not actually trying to run your jar file at all. You're not mentioning it anywhere on your command line. Secondly, it looks like your classpath is wrong - it should probably be java -cp... more 4/30/2015 6:53:42 PM
You can get an InputStream using Class.getResourceAsStream (or ClassLoader) using a class or ClassLoader that "knows" about that jar file. If you're finding that Class.getResourceAsStream() isn't working for you, you're probably passing... more 4/30/2015 5:47:39 PM
Parse the value as a MonthDay, as that's what you've got. If the month-day is not February 29th, just handle it as normal If it is February 29th, you need to special-case it: Determine whether the current year is a leap year with... more 4/30/2015 5:29:42 PM
You're not evaluating 2 * 2 + 2. You're evaluating 2 * (2 + 2) The fact that delegates are involved is irrelevant here - you're always evaluating them as soon as they're returned anyway. You can effectively rewrite the code as: static... more 4/30/2015 1:58:39 PM