Breno Pimenta

Greenhorn
+ Follow
since Mar 29, 2018
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Breno Pimenta

Hi guys,
First topic, so I expect to be in the right place for questions.

So I'm making a simple java CRUD.
I made a first class called BaseDAO, that connects to the DataBase through JDBC.
(Any thoughts on making it better would help to)



Then I'm about to call it in my next class, this method that I created (getConnection).
The problem is, what I would usualy do is, create a object of that class and then call the method on it. Like this:

It isnt working.


This is what is working:


Can someone please explain to me, why I don't need to create a object BaseDAO?
And why in the second option I don't need to iniciate the Connection conn as "new Connection", and just as null?


6 years ago


Sorry for the last coment, first time comenting  here.
Couldnt find a away to edit it yet.
6 years ago