This week's book giveaway is in the Programmer Certification forum.
We're giving away four copies of OCP Oracle Certified Professional Java SE 11 Programmer I Study Guide: Exam 1Z0-815 and have Jeanne Boyarsky & Scott Selikoff on-line!
See this thread for details.
Win a copy of OCP Oracle Certified Professional Java SE 11 Programmer I Study Guide: Exam 1Z0-815 this week in the Programmer Certification forum!

Andrzej Zahorski

Greenhorn
+ Follow
since Oct 11, 2017
Andrzej likes ...
IntelliJ IDE Linux Python
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
1
Total given
3
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Andrzej Zahorski

Sorry for grammar and missing words  - it is a bit late at my place. I'm trying to do one chapter every day, so sometimes it can consume a big chunk of time and energy.
2 weeks ago

Also I am curious, why do you want to come up with such a method in the first place ?



The only reason that I am making this is, because example in book I'm reading was not interesting for me (Core Java I by Cay Horstmann, Chapter 5). Also I found that making by myself is optimal way to imagine how features work.
This function is first idea that hit my head. Also maybe after extending it it might be useful for debugging purposes - I could pass for example collection of arguments, collection of functions and return collection of output from them. But I'm not really sure  -I am just  Java greenhorn (I think so).

So what would be remedy for not being able to use primitive types? The only thing that comes to my mind is to convert wrappers inside function to primitive types, but it feels like chore.


Also for answer with usage of streams - this is currently ahead of me. I want to use things, that I put into practice so my view of whole core functionalities in Java will be structured.
However it looks like nice hack indeed.
2 weeks ago
Hi,
I am writing program that is intended to run any method by reflection to check if I understand correctly chapter of book.
For now I am writing part that will run static methods, to focus on smaller parts.
This is how far I am:



The problem is that I get exception:
Exception in thread "main" java.lang.NoSuchMethodException: ch05.my_reflection.ReflectiveMethod.testMethod(java.lang.Integer, java.lang.Integer)

I guess autoboxing do not work here, but I am not sure. Also do you have  any idea how I could make it more functional? I want to be able to  run non-static methods and recieve return values if there is one
2 weeks ago
Hi, I was thinking about refreshing my knowledge of Java from basic concepts to advanced stuff.
I am considenring Core Java by Cay Horstmann I & II or reading tutorials from site: journaldev.com
I remember that I read about how Strings work in Java (Srting Pool etc) and it was well explained.
Anyone had experience with both? What would you recommend? I've seen posts around here from author of the book, maybe he could share his point of view too.
1 month ago
Thank's I'm adding this website to my blacklist. BTW, do you know any good resource for Core stuff?
I searched many websites and to be honest people do tons of mistakes in them. I read:
* Official tutorials - often lacking in examples
* Jenkov tutorials - webpage - bad practices in code, some of theads examples didn't work.
* Baeldung webpage - good but there's no order in it

The best page I've seen is Journaldev: webpage

Books:
* Thinking In Java - extensive private libraries and Java 7
* Core Java by Cay Horstmann - scope of topics is often wrongly placed - for example in String API guy writes multiple pages about System.out.format - this is not crucial knowledge in programming.


Hi, I am reading a tutorial from webpage about supressed  exceptions and have question about correctness of code:



Shouldn't last catch be after `if ` statement? I I can have access to resource without exception, but closing it can raise one, so can be null in this catch. Hence I think this example is incorrect.
My current concept about it is: I use interface in generics to ensure that type I will use  implements it, so if I put something that not overrides it, I'll get an error.
1 year ago
Hello, I don't understand fragment of code, since it's short I'll show it first"



Well, problem is I don't understand why I don't have to implement Comparable interface, and how I can know what this interface exactly does with my generic class? And what to do when I want different behavior from Comparable here?
1 year ago
Please write what would you do in my situation and why
1 year ago
Hello,
I am thinking about switching computer. Because I don't do that very often I want to ask you about little help.
To this moment I was using MBP 13" from 2014, mostly for Java, but I look fondly at Python and Android.
Sometimes I do private lessons from basics of programming and this is the point my soul hurts the most, it happens students bring to me complex exercises and I have to read a little in the meanwhile, when somebody is writing. Opened two windows is no option with this computer so I have to switch between workspaces a lot.

Little hints:
When I am at home I use 2 1920x1200 24" monitors.
I also like ocasional gaming from time to time and Iris is no good for that stuff.

I was thinking about this options:
* Buying 15'' macbook pro and selling actual one because it got bigger screen
* Living with 13" computer and building a Hackintosh, because of power

And why macOS:
for most part of my academic life I was using flavours of Ubuntu and I got used to UNIX like systems, but I want to have something that need no to little customisation. With macOS I just install Brew and I am ready to go. And having decent battery life with Linux costs time of optimising system.
1 year ago
Oh sorry, I focused on making text as much readable as possible, thus I didn't noticed it, thanks.

Here it goes:

Hi, I wrote simple program to learn how ExecutorService works.
Welp, I got problem - I don't know how to get answer about thread state when it is not finished, and make shutdown at the end.
Could you help me?
Idea was:
->create callable which do whatever, but returns int at the end
-> run object of class which has ExecutorService by composition
->ask about unfinished thread to know that it is unfinished
->make stop request
->check if it is finished

Here is code, it has 3 classes:

I wanted to have program that at the end (with usage of Streams) will print something like:
word1 anagram1 anagram2
word2 anagram1 anagram2 ...

But I've already did it:

It looks nice and it seems to work
1 year ago