Browsing 7239 questions and answers with Jon Skeet
System.currentTimeMillis() just returns the number of milliseconds since the Unix epoch (January 1st 1970, midnight UTC), as a long. Converting that value into a string is normally the job of something like SimpleDateFormat, via Calendar... more 10/12/2013 1:43:13 PM
You should absolutely close the WebResponse - ideally with a using statement: using (WebResponse response = request.GetResponse()) { string x = ReadResponseBody(response); } If you don't close the response, the framework doesn't... more 10/12/2013 12:26:44 PM
EDIT: To answer the edited, question, which includes: I would even be happy with making the method "un-overrideable" ... just make the method final. That will prevent subclasses from overriding it. From section 8.4.3.3 of the JLS: ... more 10/12/2013 5:47:22 AM
It sounds like really you should create a Student class, which contains their ID, their results and their desired final grade. You can then have a collection of students (e.g. a Student[] or a List<Student> and sort that by the... more 10/12/2013 5:32:02 AM
Your problem has nothing to do with nested classes, and everything to do with the fact that the method in Map is called put, not insert. What you're trying to do is entirely valid. After changing insert to put and importing... more 10/11/2013 9:39:29 PM
This is the problem: GenericStack stack = new GenericStack(); That's using the raw type of GenericStack. It's not clear why you've got this at all when you've already extended GenericStack<JTextField> to be honest. I'd expect you... more 10/11/2013 9:18:52 PM
Is there any way to fix that, without removing the single quotation mark from the string? Yes - use parameterized SQL instead. You should never use variable values directly in your SQL like this. It can allow SQL injection attacks,... more 10/11/2013 8:21:31 PM
The first problem is with your Stack class. It just implements the raw Iterable type. It should implement Iterable<Item> instead. Read more about raw types in the Java Generics FAQ. You still wouldn't be able to create a... more 10/11/2013 3:21:14 PM
I would suggest you encapsulate the "type and args" into a specific type... then you can use a params array of that. For example: // TODO: Find a better name :) public class TypeBlueprint { public Type Type { get; set; } public... more 10/10/2013 9:34:04 PM
Arrays are effectively collections of variables - so an array access expression refers to a variable, as per section 15.13 of the JLS: An array access expression refers to a variable that is a component of an array. ... The... more 10/10/2013 9:24:00 PM