Browsing 7239 questions and answers with Jon Skeet
This looks like a good place to use regular expressions (and that's not something I say often). For example: using System; using System.Text.RegularExpressions; class Program { static void Main(string[] args) { var regex... more 10/5/2014 7:24:30 AM
The problem is your finally block in equals(Object). It's always returning false, even if you're returning true from the try block. You're getting confused because of this: boolean equals=a.equals(b); //true ... but that's not calling... more 10/5/2014 3:13:11 AM
You're currently reusing the same stream to save over the top. That will only overwrite data - it won't truncate the file at the end point of your document. What you really want to do is effectively create a new file. Something like: var... more 10/4/2014 4:47:48 PM
And the only thing i want to do is this: var y = Concat(a, b); and then return an array. You can't do that unless you're within the same class as the method (or a subclass). You can stop it being an extension method just by removing... more 10/4/2014 4:39:32 PM
You can use javap to find out what fields a class has. (This is up to the compiler, not the JVM.) In this case: C:\Users\Jon\Test>javap -p Y$B Compiled from "Test.java" class Y$B extends X$A { final Y this$0; Y$B(Y); Y foo(); X... more 10/4/2014 2:49:51 PM
No, there's nothing you can do to make that compile. (There's no equivalent of the extension methods in C# which would allow it, for example.) The closest you'd be able to come would be to have a static method somewhere - whether within... more 10/4/2014 1:36:53 PM
Is there any other rule for division in java? As always, for questions like this you should go to the Java Language Specification. In this case, the relevant section is 15.17.2: Integer division rounds toward 0. That is, the... more 10/4/2014 7:59:08 AM
You've got three mistakes at the moment - one is not an error, it's just a really bad idea. The other ones are what you're running into at the moment. Firstly, you've got a static method, but you're calling it as if it were an instance... more 10/3/2014 8:50:05 PM
% isn't really a reserved character in XML. The documentation you've referred to is for SQL server, and there's a small note under the table: The Notification Services XML vocabulary reserves the percent sign (%) for denoting... more 10/3/2014 8:24:38 PM
You can't change the value of the variable i in main from within the p1 method, because the argument is passed by value: the parameter i in p1 is entirely separate from the i variable, it's just that they have the same value at the start... more 10/3/2014 7:32:02 PM