Arend van der Kolk

Ranch Hand
+ Follow
since Feb 09, 2016
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
3
Received in last 30 days
0
Total given
5
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Arend van der Kolk

I forgot to add what the program actually does. It reads from the file attached and chooses the best item with max value.

And this is an other example that does work correctly on the file: https://github.com/gavinc88/MiniProjects/blob/master/Package.java

Make a text (.txt) file with following content to the test the program(of course change the Directory in class 1 to your own directory):

81 : (1,53.38,€45) (2,88.62,€98) (3,78.48,€3) (4,72.30,€76) (5,30.18,€9) (6,46.34,€48)
8 : (1,15.3,€34)
75 : (1,85.31,€29) (2,14.55,€74) (3,3.98,€16) (4,26.24,€55) (5,63.69,€52) (6,76.25,€75) (7,60.02,€74) (8,93.18,€35) (9,89.95,€78)
56 : (1,90.72,€13) (2,33.80,€40) (3,43.15,€10) (4,37.97,€16) (5,46.81,€36) (6,48.77,€79) (7,81.80,€45) (8,19.36,€79) (9,6.76,€64)
2 years ago
Hi,

I am creating Java code for a job interview and when adding an item to an ArrayList i keep adding only the memory location into the List not the actual item with id .. etc.

My code contains 3 files and the issue is at "itemList.add(item);" in the 1st class "Packer".

Class 1

   

Class 2

   

Class 3

   
2 years ago
Hi Ron,

you are right, it doesn't actually generate an error message but the red symbol normally indicates a compile time error in the IDE.

I just cut and paste back the entire code block and the red mark at the top and the warning symbol on the bottom are now gone.

just an IDE bug i guess.

thank you for your response.

Arend
Hello,

I am following a java video tutorial. One part is to set up the html registration page.

My problem is that i keep getting this error on line 2 in my Spring Tool Suite IDE when creating the "register.html" page. Also line 31 "</form> gives a warning. See attachment for Errors.

Any idea what i am missing?





@Tony, forget my remark "is that just using a long literal ?" it didn't make sense.
2 years ago
So when Integer a and b are both 128 they are no longer from the same cached Object?



Console output:

false
false
false
2 years ago
is that just using a long literal ?
2 years ago
thank you for the clear explanation. And what does it mean for the cached Integer objects if the value is 128 and more?

Integer x = Integer.valueOf(128);
2 years ago
Is there any difference in Java compiling or execution between below statements?

Integer x = new Integer(1);

Integer x = 1;

They both create a new object to my knowledge.
2 years ago
True, thank you. and the reference type is declared at compile time
2 years ago
Thank you for explaining, it is more clear to me now that accessing via extended has to go via the type of the Object on which you perform the access
2 years ago
Can someone explain one more time why the compiler only knows the types of the references? And why it does not know the runtime of the Object?

Qoute above:
"The compiler only knows the types of references. It doesn't know the true runtime type of an object."

Thank you,

Arend
2 years ago
Hi,

I still do not understand why "Acc obj = new Test()" will not give access to the protected integer in the superclass but "Test obj = new Test()" will give access.

Acc obj = new Test(); <- NO acces to protected integer
Test obj = new Test(); <- YES acces to protected integer



2 years ago
thank you Pawel, interesting to see the difference between the labeled break and the labeled continue statement.
2 years ago
Hello,

I have been doing fundamentals now for a year but i have not yet come across a statement like "z:"

What does z: mean here in this class?

2 years ago