Mykhailo Kozik

Greenhorn
+ Follow
since May 12, 2011
Mykhailo likes ...
Eclipse IDE Java Ubuntu
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
5
Received in last 30 days
0
Total given
2
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Mykhailo Kozik

This class won't be public until you would write public
Default (without any keyword) visibility means that your class visible inside package where it defined.
12 years ago
If you are using Eclipse IDE, press F11, and use step execution in debug perspective.
12 years ago
In general, when you create method you should be aware about context of your application, also maybe some architectural question.

For example you want to add two numbers

Simple way to use static method in some class.


But the problem is when another method wants to do some actions with result.
Thats why you must get result, and pass it to another method.
Imagine if there are lot of such methods, and your callings will be look like:

and so on.

But you can define class with responsibility of all these operations.
You need only one holder for this simple example:

As you see this code pretty bigger than previous one, but it more understandable.
Perhaps, you must see which approach is better for your program structure.

P.S. As i know, you can't create object without keyword new. Maybe it possible via reflection API.
P.P.S. Good book about art of programming that describes similar problems Bob Martin - Clean Code
12 years ago

returns actual passed type.

For example, if you call test1() with param new HashMap<Integer, String>() it means that stuff.entrySet().iterator() returns Iterator<Entry<Integer, String>>.
But in general Iterator<Entry<Integer, String>> not compatible with Iterator<Entry<? extends Number, String>>
12 years ago
The best one: Head First Design Patterns
for advanced reading use GoF Design patterns
12 years ago
.class is a byte-code
use decompiler to see it content
12 years ago

Dave Alvarado wrote:Mykhalio,
PreparedStatement is not going to work ...



Really, i don't see the problem.
Use complicated part as part of PreparedStatement.
Use PreparedStatement.
It automatically prevents injections and also has higher performance.
I recommend to you read
1. Horstmann "Core Java"
2. Eckel "Thinking in Java"
12 years ago

Mike Sabo wrote:You were 100% correct. I changed the method name in all occurances to toString() instead of the returnString() and it worked; however i'm curious. Why did it make a difference as to what my method name was?


Because every your class implicitly extends Object, and toString() - its an Object's method.
If you call:

it means that you call:

But as second way you can call:

So, choose appropriate for your goals. First way is preferable.
12 years ago
Agree to google this question.

But in simple words: When you execute java program you run process which can contains many threads.
12 years ago
I recommend you to read basics, it will be really helpful.

So, you can try this pattern for interactive loop:
12 years ago
Hi,

I understood that blank line means two returns (\n\n)
i think better solution to use StringTokenizer:


12 years ago