Nani Ksowy

Greenhorn
+ Follow
since Sep 22, 2019
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
16
Given in last 30 days
4
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Nani Ksowy

Congrats! Did the exam include a lot of concurrency and modules questions?
Hello,

Can I skip the Chapter 17 (Modules) and come back to it after the final Chapter 22? Or, perhaps is that knowledge required for any of the chapters 18-22?

Talking about Complete Study Guide book.

Thanks!
Hello, do you guys find the questions in the Study Guide book more difficult than the questions on the exam? Putting aside that the book does not mention how many answers are valid.

Thanks for sharing.
Hello,

Can you share some data or your experience about the questions distribution on the exam?

I have heard there are a lot of Stream API questions, so it's probably good idea to pay special attention to that subject, right?

Which subjects can be, relatively, neglected?

Thanks
Hi.

Which learning method for the 1Z0-819 exam do you think is more effective? I am using Study Book guide and the new Practice Book (1000 questions). Both books seems very decent and are of the same authors.

Do you think it's better to keep the 1000 questions book for after the whole Study Book book is finished reading?

Or perhaps would it be better to read both books simultaneously, that is: to increase the number of questions after each chapter from the default 20-25, to the 70-75, by including the extra 50 questions from the 1k questions book?

Can you share your thoughts which method might be more effective? I know it might be subjective.

If that matters: seems like I usually score about 60% when doing the 20-25 questions after each chaptter. :/
Hello, I've started studying for the 1Z0-819 exam.

I bought OCP Complete Study guide (Jeanne Boyarsky, Scott Selikoff) and the corresponding recently released practice book.

But I suspect that I will need more materials than that. Specifically, I need a larger questions pool. Therefore I will buy Enthuware's mock exams (~1000 questions).

Still, I would prefer to have even more questions to go through. I am especially worried about the 1Z0-816 part. Can you recommend some extra materials, please? Thanks!
Hello,

Why does the long primitive type default to 0L, but the float type defaults to 0.0? Is this some weird rule?

If the float defaults to 0.0 and not 0.0f, then I'd expect that long would default to 0 and not 0L. I think it should make sense?

Also, the table num 2.3 in the complete study book (815/816/817) says that long defaults to 0 and not 0L. But then, the question 8 in revision num 2 says long defaults to 0L...

How do I memorize that?
With Java 17 (LTS) being released in September this year, when can we expect the new OCP 17 exam?

Perhaps it is possible to roughly estimate it, due to previous experiences with how fast Oracle reacts with introducing new exams, after new Java LTS launched?

Basically, I am wondering if it's a good idea to attempt 1Z0-819 on July/August 2021, since Java 17 will have been released by 2 months later...
HelloSpringApp.java:

GymCoach.java:

And applicationContext.xml:


When executing above code (plus some basic interfaces and FortuneServices, probably doesn't matter), I get the following output:

Inside CRICKET-COACH no-arg constructor
Inside CRICKET-COACH setter method

Heavy weight bench presses
Not the best day it might be!



And here's the CricketCoach class:


So basically:
Inside HelloSpringApp I am creating theCoach object from a "myCoach" bean that's configured inside .xml.
myCoach bean is tied to GymCoach.

Yet for some reason, those "debugging sysouts" are printed as well. From CricketCoach. Why would my program access CricketCoach class? Once again, inside .xml myCoach is tied to GymCoach; not to CricketCoach.
1 year ago
Hello,

I have this simple form that prompts user to register himself with username and password.

The form is located in register.jsp file:

In web.xml I have the following servlet description:


And lastly this is the register.java file:



Everything works fine, except for the actual URL names.

No matter if the user has been successfully registered ('else' block launched), or the user has failed at registration ('if' block launched), I will be redirected from localhost:8080/register.jsp to localhost:8080/registered

Current behaviour: localhost:8080/register.jsp --> successful/failed registration --> localhost:8080/registered

What I want to achieve is:

On successful registration: send to: localhost:8080/congrats.jsp
On failed registration: send to: localhost:8080/register.jsp (which means redirect to the same page)

Currently, the actual content that gets displayed on the site is correct and fine. It's just the URL names that are wrong and bother me.

So most likely this is caused by:

and


But then again, I am not sure how to handle this.
1 year ago
And then I would need to do something like this? Whenever calling  registerNewUser method:

Basically I wanted to write a method that inserts new record into the database (MySQL, if that matters). Any logic such as: does this record already exist in the database? is excluded, for simplicity.

I have came up with this:


Here is another "permutation" of the above code, with PreparedStatement defined outside Try block and closing it in a Finally block:



This code just looks so ugly to me. Note: I think I can outsource lines 11 ~ lines 15 to another private method, but that's not the point of this thread.

And the third version also sets Connection and PreparedStatement instances to null:



My questions come down to:

1. What's wrong with my exception handling? I am sure there's room for improvement. Especially closing the PreparedStatement or Connection.

2. What should be the scope of instances of Connection or PreparedStatement? I can define both Connection and PreparedStatement inside a try block, or both outside a try block, or for example Connection outside and PreparedStatement inside.

I suppose the difference where I define it comes down to Exception handling. If I define PreparedStatement inside try block, then I cannot close it in finally block.

3. Because I've used PreparedStatement instead of Statement, is this sql injection safe? Is it that simple?

4. Basically, is this how it's done in pure Java? I have just started learning so I don't want to jump straight forward into Hibernate/Spring.

Thanks.
I am fresh-new to OOP and Java. I had some brief experience in procedural languages like C.

Straight after OO HelloWorld I have written this TicTacToe. What I am trying to say: I have no experience with object oriented paradigm, thus I don't know what kind of mistakes I make.

Would anyone be able to point out my mistakes? I mostly care about the OO mistakes, anti-patterns and such. Not necessarily the game logic itself.

InputManager.java:


Player.java:


Board.java:


Game.java:


Main.java:


Also added following code to gist: https://gist.github.com/Wenox/03cf0dc45aef0bb22820e579659bbf9a

If anyone could point out the mistakes I've made from the object-oriented standpoint, I could appreciate it.

As I have no experience at all I couldn't reason whether X solution would be better than Y solution. I did whatever "felt right".

For example, Game class is never instantiate and uses only static fields. I also feel like that class is bit too long.

I placed `makeMove()` function within `Game` class in order to avoid cyclic class dependency; I am not sure if that function should belong in there or not. Also, because Game class never uses its constructor, I am creating other objects the Game class needs by using initGame() static function. I suppose I could as well do that in a constructor.

I am basically wondering what's wrong the most with my code.

Advices appreciated.
1 year ago