Win a copy of Microservices Testing (Live Project) this week in the Spring forum!

Jj Hill

Ranch Hand
+ Follow
since Jul 25, 2011
Jj likes ...
Netbeans IDE Chrome Java
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
2
Received in last 30 days
0
Total given
13
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jj Hill

Just note, "Can't solve error" is a really vague title on a programming forum...
9 years ago

WeiJie Lim wrote:@ Jj Hill :
Hmm so this.foo = foo; essentially makes the instance variable foo to be equal to the local variable foo right ?


Yes.
9 years ago

Campbell Ritchie wrote:You are correct about shadowing, but not to call it a class field. It is an instance field. You only call fields class fields if they are static.


Ok thanks, I didn't know that.
9 years ago
I haven't looked through why doFoo() doesn't work yet but I'll get to that.

is a matter of scope. http://www.java-made-easy.com/variable-scope.html
Basically, in class Bar there are two variables named "foo" - the one in the parameter of the constructor ("public bar(Foo foo)") and the class field - "private Foo foo"
The code sets the class field foo to the parameter foo, because otherwise you would just be setting foo equal to itself (parameter foo takes priority over class field foo).
tl;dr this.foo refers to class fields, and foo refers to local variables when applicable.
9 years ago
The "+" won't do anything while inside the quotation marks - it's just text, a string literal. The only character that has any effect in the string literal is "\".
9 years ago
System should be capitalized..
9 years ago
It says "Files with the extension .zip are not allowed as attachment in the message." Maybe you could give me an email?
I fixed the package thing...but it still says "existing manifest"...facepalm
I added a package, but now another class under the same Game project says "cannot find symbol" in the source code(syntax err)
The "null..." file says:


Doesn't look like anything's wrong to me.
I've tried that. The IDE just creates a new file called "null<random number>", replacing the old one.
When I attempt to clean and build my Netbeans project, it says C:\Users\Jimmt\Documents\NetBeansProjects\Game\nbproject\build-impl.xml:685: Existing manifest C:\Users\chsieh\Documents\NetBeansProjects\Wallnut Defense\build\null443973729 is invalid
In "build-impl.xml:685" the line of code that has the error is:


I have images in a src file inside the project file and my project relies on another Netbeans project. I also need to know how to embed images into a .jar file, but I'll ask that separately. I'm not sure whether this belongs in the Java in General forums or not but please reply. Thanks

The best protection I can think about would be to set up a 7/24 server


You're right, but not everyone has a server.
10 years ago
http://www.roseindia.net/java/beginners/java-write-to-file.shtml shows how to save a file. I have a better way to do it - get the date that the program was first downloaded at, save that in the file, then get the current date when the program is opened. Then find how many days are in between and if that amount exceeds your "x" amount of days, disallow access to the program functions.
10 years ago