r/javahelp • • Mar 30 '20

Why was var added?

36 Upvotes

All it does is make code trickier to read and tempt the programmer to pay less attention to the type of his variable. Another way to not write clean code.

It seems like a downgrade, why was it added? Is it considered a valuable addition to the language?

For context, https://openjdk.java.net/projects/amber/LVTIFAQ.html answers this as making Classname variableName=new Classname(); shorter. Ok, then why not make it : Classname variableName=new .(); It's shorter and no conflicts with existing variable names. Nor would you have to be aware of caveats like "this can't be used as a parameter".


r/javahelp • • Sep 02 '19

Roast my project.

36 Upvotes

Hello Java helpers. I need help today, hence reaching out to you guys. Hope this post won't be taken down (Thank you very much mods).

Let me start with a backstory. I graduated 3 years back with bachelors in Mechanical engineering. However due to my strong interest in computers and coding, I decided to switch career after quitting my job about an year ago. I used to develop Android applications on small scale during my final year of college. So I had experience with Java back then. Then after I took up a non-c.s. job for couple years, I kinda drifted away from all that. After quitting my job, I decided to bounce back and start from the scratch. So I've learned Java (again), Spring framework and some of it's modules, MySQL, Hibernate, some frontend stuff inlcuding Bootstrap and JS basics.

Before I apply for jobs, I decided to do a project out of self-interest based on the technologies that I've learnt and today I was able to complete a part of it.

So, I play Pokémon Go and there are in-game events like raids, egg hatches, special research encounters, research tasks and many more. What I've done is created a rest-api that provides these details in json payloads. There are many websites that already host these details like Silphroad, Leekduck, Pokemon GO hub and many others. However I wanted to implement a rest-api for the same.

I happily present to you: PokéGo API V2

Source code is available at GitHub.

Experienced devs of this group, I request you to please perform a code review on my project when you have some time to spare and help me by pointing out what did I do wrong, what missed, what are the areas of improvement, e.t.c. I want to be able to train myself to develop and deliver industry standard applications and be able to face interviews with confidence. Your point outs, tips, reviews, comments, e.t.c will help me improve myself as a developer. Please go brutal on me.

Not only me, but others also can take a look at my project, combined with your inputs and be able to learn few things, avoid rookie mistakes and stuff. Your inputs will help me and others a lot, lot, lot in career.

I'm also planning to take this project as a mainstream application, combined with few other big features later down the road. If anybody is interested in contribution to this project, I'll be very happy to collaborate with you.

Thank you very very much for all of your time guys.


r/javahelp • • Mar 18 '21

Quick question about Oracle Java Certification, they are celebrating 25 years and sell it for 25$

35 Upvotes

https://education.oracle.com/oracle-certified-professional-java-se-11-developer/trackp_OCPJAV11

Anyone has experience with this and knows whats inside? Are you buying access to a timed event or is it sorta "studying" with topics, questions and best solutions like thing?


r/javahelp • • Mar 29 '22

Finally,i got my first job as a Junior Java developer, but i am feeling bad...

34 Upvotes

So finally, i became software developer, so many failed interviews, so many tears, and unslept nights. It is my 3rd week at my new work, but my team lead is saying that i am not experienced, and don't know most of the things. And he is saying me that if i willl not complete the tasks he will fire me . But i am Junior , and it is my first month, is it right what he is doing? I think it is not right, and at least to require from me after one month! How do you think?


r/javahelp • • Oct 05 '21

What is Maven and Spring and why do I need them for a successful career in Java?

34 Upvotes

Please dumb it down. I started a Udemy course on Spring and so far has confused me more than helped. I am so so in Java after 1.5(still in progress) semesters of it.


r/javahelp • • Feb 06 '21

How to kill a thread in Java or gracefully end it.

34 Upvotes

I have a code part which do IO calls to get mails. Wanted to move that to a thread and end it after sometime.

The stop method on Thread class is deprecated and Any other safe way to stop the thread.

Which gives 100% guarantee that the thread is stopped gracefully after some time.

Thanks in advance.


r/javahelp • • Dec 26 '20

Is it good practice to ALWAYS write "throws" in the method signature to show which exceptions could be raised? Should this be done everytime?

34 Upvotes

Is it good practice to ALWAYS write "throws" in the method signature to show which exceptions could be raised? Should this be done everytime?


r/javahelp • • Jul 21 '20

Is there a reason Java doesn't let you return multiple values like C#?

34 Upvotes

So, in C# I can do something like

(int, string) func()      
{     
  ...
 return (int, string);        
}        

Is there some special reason why Java doesn't allow that?


r/javahelp • • Feb 14 '20

Applying Java in the Real World

34 Upvotes

I’ve been doing Java programming for 4 years now (2 years in high school, almost 2 years in college), but i feel like I'm not going anywhere with what I'm learning. I can grasp the concepts fairly well and have gotten better at creating algorithms, but everything I'm doing doesn’t feel meaningful because it’s all surrounded by completing code examples. 

My professor is currently using Daniel Lang’s Introduction to Java Programming. We recently completed Inheritance & Polymorphism, and are supposed to move on to JavaFX, Animations, Queues, Hashing, Weighted Graphs and Applications, and some other topics. 

With this being said, i’d like to know: 

Should i continue progressing with the topics in the books before anything else?

Or

Is it possible that I can apply my knowledge of Java to real life issues and projects, instead of solving simulation-like questions, and if so, what are some resources that can help guide me? 

Thank you in advance


r/javahelp • • Apr 18 '19

Solved What's the point of interfaces?

34 Upvotes

We've been learning interfaces in my class and I have a good grasp on the concept, but the thing that confuses me is what's the point? Your just writing more code as a blueprint to put classes in "groups". Maybe the code I'm writing is not large enough to make interfaces useful. Can some one help me in learning the use of interfaces. Thanks in advance!


r/javahelp • • Dec 14 '21

Experienced Java Programmers, what are your tips to become better at Java?

33 Upvotes

Any key tips will be appreciated! Also, if you are going to say practice please expand on it, thanks!


r/javahelp • • Sep 15 '19

Is Java EE in demand?

33 Upvotes

Hello, as a junior, I'm interested with Spring, Microservices, REST, Docker, AWS etc. HR of a company contacted me about Java Developer position but it's based on Java EE, Oracle & MSSQL. As far as I know, Java EE is a bit legacy (and is an alternative to Spring) and used by banks and other fintech companies. I want to be relevant and keep my skills up to date throughout my career. Though, I want to know your point of view on this. Is Java EE in demand and will it remain so for the next 20-30 years? (I know it's hard to predict such things in tech industry but it may worth predicting trends)

Thanks!


r/javahelp • • May 16 '19

Got this question in my Java Software Development class. Can anyone explain why the highlighted answer is correct?

33 Upvotes

https://i.imgur.com/du7vhZw.png

The same class also said "== compares the memory location, but = compares the content", so I am starting to question everything I have learned in this course.

[EDIT: Teachers answer for the above statement about the =s]

"Hi Redacted, The correct answer is == compares the memory location of the object, while = compares the content. == helps confirm that two variables actually reference the same object in memory."

(High School class BTW)


r/javahelp • • Jun 19 '15

r/javahelp is the subreddit of the day!

33 Upvotes

Hello everyone!

as the title says, r/javahelp is the subreddit of the day!


http://www.reddit.com/r/subredditoftheday/comments/3aedzr/june_19th_2015_rjavahelp_and_rlearnjava_i_love/

Do read the article and check out the other subs featured!


Have a great weekend! :)


r/javahelp • • Oct 12 '25

Unsolved Database Connection Pool is not allowed on my company, help me understand it please

32 Upvotes

Hi guys. I'm a software engineer with two years of experience in the fintech sector, where I've always worked with the Java + Spring Boot stack.

The thing is that in the projects of one of the clients of the company I work for, one of the conditions is prohibiting the use of JPA/Hibernate (in addition to forcing us to use Java 7). I didn't quite understand the reason, so after digging a little deeper into the issue, they confirmed that it was because (according to the project manager) "JPA opens a connection pool, which ends up causing errors or crashing that specific client's database."

I assume he's actually referring to the HikariCP connection pool, but I still don't understand why a Hikari connection pool would crash the database? Is it simply because the client doesn't have the connection pool configured correctly?


r/javahelp • • Feb 22 '21

Maven vs Gradle

32 Upvotes

I googled this question and I find that gradle is kind of faster about 10 times and its less verbose and generally its better that maven but although that, almost every tutorial use Maven.

Can anyone explain what tool should I pick and why?


r/javahelp • • Sep 28 '20

Unsolved What is the different between JWT ID tokens vs. OIDC userinfo endpoint?

32 Upvotes

Hello,

First of all, apologies if this isn't the right place to ask this question.

So, I have been learning about OAuth 2.0 and Single Sign-On for some time. I have trouble understanding how the whole flow looks like.

As I understand, OAuth 2.0 is a protocol to allow a client to access a resource from a third-party service. OIDC is built on top of this and it provides the ability to login via a third party service.

Based on this, there are two login flows for SSO that I have seen:

  1. Get access token and then hit /userinfo endpoint for assertion.

  2. Assertion encoded in the token using JWT.

/userinfo Flow:

 +------------------+        Authorization       +------------------+
 |                  | +------------------------> |                  |
 |                  |                            |                  |
 |                  |        Access Token        |                  |
 |                  |  <----------------------+  |                  |
 |                  |                            |                  |
 |                  |                            |                  |
 |      Client      |                            |     Identity     |
 |                  |                            |     Provider     |
 |                  |       /userinfo + Token    |                  |
 |                  |   +--------------------->  |                  |
 |                  |                            |                  |
 |                  |                            |                  |
 |                  |        Login Assertion     |                  |
 |                  |   <----------------------+ |                  |
 +------------------+                            +------------------+

JWT flow:

+----------------+                         +----------------+
|                |     Authorization       |                |
|                | +-------------------->  |                |
|                |                         |                |
|                |                         |                |
|    Client      |                         |    Identity    |
|                |                         |    Provider    |
|                |                         |                |
|                |     JWT Assertion       |                |
|                | <--------------------+  |                |
|                |                         |                |
+----------------+                         +----------------+

Questions:

  1. What is the difference between these two flows? What is the need for having multiple ways to accomplish the same thing? I understand that JWT makes sense because it looks more efficient with less number of calls but I am not understand the overall logic.

  2. How to enable JWT authentication instead of /userinfo endpoint authentication in Spring Boot Security?

  3. Are there any good examples of Spring Boot Security with React/Vue for login with SSO flows?

Thank you!


r/javahelp • • Jul 19 '20

Is there more to Spring Boot than a REST API?

32 Upvotes

Hi

I've been studying java at my uni for the past two years and think I really enjoy the language and want to pursue it formally after I graduate next year. I have used Java Swing to create a desktop application before but now have to choose a more robust framework for creating a website which connects different API's and also manages information about some users.

I have discussed this with a few peers and have been following this tutorial to get my hands wet with it:

https://www.youtube.com/watch?v=i-hoSg8iRG0

but it seems to consist of making a website using API calls to get,post, delete data from the server.

My questions are the following:

  • Is Spring boot the best framework to use for my project so as to increase my employability as a java dev?

  • My concern is to limit myself to a particular framework that only does one thing - Is there more to the spring boot framework than creating REST API's or RESTful web applications? Or am I just being stupid and essentially all web applications make API calls to the back-end?

Thanks.


r/javahelp • • Jul 17 '20

Codeless Nearing the end of my Java course, feeling lost

32 Upvotes

It’s taken me a couple years to figure out what I wanted to do after high-school, along the way I’ve dabbled with some light front end languages like HTML & CSS. Just recently I decided to major in computer science and my first programming course revolved around Java.

Now that I’m approaching the end, I feel unaccomplished, I have written notes and completed assignments but I feel as if I haven’t truly understood most of it. When given a problem to solve, my mind goes blank and I am never sure of a route to take to solve it with Java.

Sorry for the rant, but this was the only place I feel could possibly relate to me to some degree. I ask if you guys can possibly share any courses, videos or any kind of material that helped you understand the language the most from a different perspective.

Thank you in advance for the help!

TL;DR - Anyone have some kind of video/course they’d like to share to help someone struggling to grasp the language?


r/javahelp • • Jul 08 '20

Spring Boot Social Login Demo App

32 Upvotes

Hi Guys, I have created a small demo app of how you could implement and integrate social login to your Spring Boot application. You could find it at my GitHub https://github.com/vzhemevko/spring-social-login

Let me know what you think, hope it could be useful for somebody!


r/javahelp • • Jun 05 '20

How does Java and Javascript work together in building websites?

32 Upvotes

I'm learning Java right now, but eventually I want to learn Javascript as well to be able to build website and servers. But I'm not sure how they actually come together.

It will be great if someone can eli5 using an example... let's say I want to make a website for a bakery shop. How can I use Java and Javascript to create a website that enables me to receive orders, ship them out to my customers, and store the data somewhere in my computer so I can write algorithms to analyze the data?

And then maybe use that data and feed it back into the website. For example I send data from my warehouse back into the website, so the customers can see which kind of bread is most popular and which sold out.

That kind of communication. I don't know how it happens and I am curious to find out how I can make it happen with Java and Javascript.

It'll be great if you can also enlighten me on the specific things I should learn. This will give me some kind of direction and serve as milestones perhaps?

Also, I heard one can build entirely using Javascript. Is there an advantage/disadvantage to doing so as opposed to using Java for back-end and Javascript for front-end?

Thank you in advance.


r/javahelp • • Oct 23 '19

Can you put a while loop inside a while loop?

32 Upvotes

This is probably a stupid question, but I'm in desperate need of help. So I'm taking an online Computer Science course, and am writing a program that is giving me a lot of trouble. Towards the beginning of the program, I have a scanner input, but when I run it with a while loop inside of a while loop, it keeps requesting input. Can I not do that?


r/javahelp • • Sep 19 '19

What IDE do you use for your profession? And is Java big in AI?

32 Upvotes

I’m in college with a AI concentration. I’m curious to what IDE do most people use. I’ve been using eclipse and netbeans. Also for people who have AI jobs do you use java a lot and is there a lot of coding? Ive only taken a few Comp sci classes and I’m really interested in the real world after. Thank you.


r/javahelp • • Apr 29 '16

What is Stackoverflow's problem?

32 Upvotes

I'm a beginner to Java - every time I post a question on Stackoverflow I am greeted by a torrent of downvotes or I get my post put on hold/edited/marked as duplicate for some reason even when I read everything relevant first, even though this doesn't help me. I thought this was a place where we can ask questions, I seem to get quick responses and get help some of the time but why is this community so assholish? I don't understand the purpose of the website if they are like this?