r/learnjava • • Jun 22 '20

Resources to learn more advanced topics

43 Upvotes

I have been looking for a course that teaches databases, docker, spring framework, REST and all the other more advanced topics that are needed to be a java developer. I found: https://www.udemy.com/course/java-the-complete-java-developer-course/. However it is a really steep price. I was wondering if there was a free resource that teaches these topics well


r/learnjava • • May 20 '20

What is the purpose of super() in a class constructor method?

43 Upvotes

Would it be accurate to say that the word super makes the class inherit all the methods of its parent class which is Object? Is the line super(); responsible for Java knowing that every instance of my class is also an Object? Does the super(); line do anything else in this case?

Just in case this needs clarification, this is what i'm talking about

public class Product {
       int id;
       String name;

public Product(int id, String name) {
	super();
	this.id = id;
	this.name = name;
   }

r/learnjava • • Sep 24 '19

What is the best website for completing Java/coding tasks that you know of?

43 Upvotes

Bored out of my skull of following along with tutorials now and have sucked up all the syntax tutorials I can.

I've had a look at a few websites, apart from Projecteuler- are there any programming related websites that have a vast list of tasks/problems to solve? There seem to be a good few, wondering what are the best.


r/learnjava • • May 30 '19

My Self-Study Plan for a Couple Years?

43 Upvotes

r/learnjava • • Jul 08 '18

Effective Java 3rd edition summary

43 Upvotes

Hello everyone,

I've read this book and learn a lot of things. Along the way, I also wrote a summary that I thought I could share : https://github.com/david-sauvage/effective-java-summary

Hope it will help a few of you.

Have fun :)


r/learnjava • • Dec 22 '25

What is the semantic difference between an interface and an abstract class?

42 Upvotes

I understand the mechanics—interfaces support multiple inheritance, abstract classes can declare instance variables and override Object methods, etc. However, I don't understand what it means to call something one or the other, especially because default methods exist.

In short: if I declare abstract class Foo, what am I saying about the nature of all Foos? Critically, how does that change if I declare interface Foo instead?


r/learnjava • • Jun 23 '25

Most required skills with Java on jobs/interviews

42 Upvotes

I was thinking we can create together a list of most required skills/technologies required for java developers in interviews/jobs.

I can start the list with JPA&Hibernate, Spring stack, AMQP, Kafka.


r/learnjava • • May 12 '25

Transitioning into a JAVA Developer

42 Upvotes

Hi, I am a working professional, I want to learn JAVA and spring, I am quite clueless what are the good resources, can anyone help me with it, I am working on JAVA Restful APIs


r/learnjava • • Sep 21 '22

Any spring boot YouTube channels you could recommend?

42 Upvotes

would love updated toturial series for spring boot


r/learnjava • • Jun 14 '22

Web Programming with Java

42 Upvotes

My internship company gave me a task to do in order to join them officially. They want a online shopping site with some functionalities. I don't know anything about web programming with Java. I use Java to solve problems, also have the knowledge of OOP concepts. They said that you can use Spring MVC or Spring Boot for backend and JSP for frontend which i am foreign to those concepts, languages. Which concepts should i learn and where should i learn?


r/learnjava • • Mar 15 '22

I didn’t look at this subreddit for a big assignment and now feel amazing after completing it

42 Upvotes

It was Part 2 33 and 34

Took a total for like 20 hours and I’m fucking impressed with myself

Normally after a few errors I’m sprinting to this subreddit but now I don’t need to as much

Unless it’s just a Google search reminding me how to use a for loop


r/learnjava • • Feb 27 '22

How can I practice Java Generics, Collections Framework, File I/O, Streams and Multithreading

42 Upvotes

I'm currently reading Java Complete Reference and have been trying it's Example Codes but I'm not getting how can I use them in real world Programming or how can I practice above mentioned topics.

Are there any online resources or assignments that could help me to work more on these topics. I've tried using Online Coding Sites but I'm still finding it hard that how can I leverage these while writing Java Code.


r/learnjava • • Sep 12 '21

Beginner, don't understand the general structure of Java

42 Upvotes

Learned Python when I was 13~, now I'm in high school and we're learning Java. I kind of just.. Don't get it.

Many questions, but:

  1. Why is everything in a class? What's the point of that? In Python, classes were (to me) a better and more organized way of ordering data, for example when I have multiple characters (or even one if there are many many variables), having a class helps for obvious reasons. You can put many things in a framework without having 100+ variables. But.. Why everything? I feel like I don't understand classes enough to realize what they really are, which's support by the fact in python I just copy paste the same code to create classes because I don't get what it means and don't remember it. In anycase, seems really weird your ENTIRE program is just a class.

  2. What's going on with starting up programs? My teacher admitted we're not really supposed to understand what's going on there yet, but I have some general knowledge so I think I could understand. So you have a class (refer to q1), then.. "public"? "static"? "void"? Only familiar face I can see is the "main" you specify for the main operation of the program, and even that I definitely do not fully understand.

  3. Also, variables are kind of annoying. I get the need to define what kind of variable something is, but sometimes it's annoying. I get the fact that Python is slow exactly for reasons like trying to make variables more comfortable, I just wish for a general.. Explanation.

  4. String arrays? Arraylists? Comparisons to Python will help.

Following the end of the third question, most of this comes from the fact I just don't understand the general structure and idea of Java, and what it's doing. Honestly, when I started with Python I saw one comment on my post telling me it's gonna be hard to move to other languages, and it was downvoted to death. Not saying this is hell, just that the extra syntax is kind of annoying, for now.

One last thing. I heard from online discussion that many people hate object oriented programming. Aren't class objects.. Objects? And Java is.. Just classes?

Thanks.


r/learnjava • • Aug 31 '21

MOOC doesn't go into detail about streams and lambdas.

42 Upvotes

https://java-programming.mooc.fi/part-10/1-handling-collections-as-streams

Having already worked with JS, I understand how to use streams and lambdas. However, streams & lambdas seem to be a departure from Java's strictly OOP approach. But whereas before I could understand everything about my imperative Java code, there seems to be some behind the scenes magic going on with these topics. Should I search for their underlying implementation, or is knowing how to work with them sufficient (although it's not satisfying)?

I think they would have been easy to understand under the hood if they were just syntactic sugar for anonymous classes, but on googling a bit, I read that they aren't and use something called `invokedynamic` in the byte code.

Also, streams and lambdas are easier to understand in JS because functions are first-class citizens (or objects) so passing them around isn't really something complicated or magical.


r/learnjava • • Aug 11 '21

Studying for Java

42 Upvotes

How do you guys study for Java ?

I am taking notes and coding at the same time with Codecademy. I keep finding my self not able to really put what I learn to use yet. I am having a hard time to learn Java because of not taking the info the right way.

Any tips for beginners and how to study ?


r/learnjava • • Aug 07 '21

Do you know of any good Spring Boot sample projects?

42 Upvotes

I'm looking for the source of a clean Spring Boot application so I can study the code, patterns used, etc. The closest to that I could get is this JHipster sample application. I've learned some things from it, but it's quite small, so not a lot to see.

I'm honestly amazed by the lack of results that come up when I search "Spring Boot sample app", as most frameworks always have samples. Why could this be? Maybe I'm looking in the wrong place?


r/learnjava • • Apr 23 '21

Please roast my first attempt at Java!

42 Upvotes

Coming from C and C++ and just got my first Java program to compile. Generics are actually not like templates! ;) How bad is it in the eyes of a Java programmer? What are the key mistakes I should avoid to eventually find the Java way. Generics used correctly? Anti patterns?

Program is just a graph data structure and a breadth first searcher.

import java.io.*;
import java.util.Vector;
import java.util.LinkedList;
import java.util.Queue;
import java.util.HashMap;
import java.util.Collection;

enum Color { white, grey, red, black }
enum Control { accept, discard }

interface Vertex {}
interface Edge {}

abstract class Visitor
{
    public void start(Vertex root) {}
    public void finish() {}
    
    public Control vertex(Vertex v) { return Control.accept; }
    public Control edge(Edge e, Color col) { return Control.accept; }
}

interface Graph<GraphProperty, VertexProperty, EdgeProperty>
{
    GraphProperty property();
    void property(GraphProperty x);
    VertexProperty property(Vertex v);
    void property(Vertex e, VertexProperty prop);
    EdgeProperty property(Edge e);
    void property(Edge v, EdgeProperty prop);
    Vertex addVertex(VertexProperty x);
    void removeVertex(Vertex x);
    Edge addEdge(
        Vertex from,
        Vertex to,
        EdgeProperty prop);
    void removeEdge(Edge x);
    void clear();
    boolean isEmpty();
    int vertexCount();
    int edgeCount();
    Collection<Vertex> vertices();
    Collection<Edge> edges();
    Collection<Edge> inEdges(Vertex v);
    Collection<Edge> outEdges(Vertex v);
    int index(Vertex v);
    int index(Edge e);
    int inDegree(Vertex v);
    int outDegree(Vertex v);
    int Degree(Vertex v);
    Vertex source(Edge e);
    Vertex target(Edge e);
    void bfs(Vertex root, Visitor vis);
}

abstract class AbstractGraph<GraphProperty, VertexProperty, EdgeProperty>
    implements Graph<GraphProperty, VertexProperty, EdgeProperty>
{
    public abstract class AbstractVertex implements Vertex
    {
        private VertexProperty property_;
        
        protected int index_;
        
        public AbstractVertex(VertexProperty prop, int index__)
        {
            property_ = prop;
            index_ = index__;
        }
    }
    
    public abstract class AbstractEdge implements Edge
    {
        private EdgeProperty property_;
        
        protected Vertex src_, trg_;
        protected int index_;
        
        public AbstractEdge(EdgeProperty prop, Vertex from, Vertex to, int index__)
        {
            property_ = prop;
            src_ = from;
            trg_ = to;
            index_ = index__;
        }
    }
    
    private GraphProperty property_;
    
    protected AbstractGraph(GraphProperty prop)
    {
        property_ = prop;
    }
    
    public GraphProperty property() { return property_; }
    public void property(GraphProperty x) { property_ = x; }
    public VertexProperty property(Vertex v) { return ((AbstractVertex)v).property_; }
    public void property(Vertex v, VertexProperty p) { ((AbstractVertex)v).property_ = p; }
    public EdgeProperty property(Edge e) { return ((AbstractEdge)e).property_; }
    public void property(Edge e, EdgeProperty p) { ((AbstractEdge)e).property_ = p; }
    
    public int index(Vertex v) { return ((AbstractVertex)v).index_; }
    public int index(Edge e) { return ((AbstractEdge)e).index_; }
    public int Degree(Vertex v) { return inDegree(v) + outDegree(v); }
    public Vertex source(Edge e) { return ((AbstractEdge)e).src_; }
    public Vertex target(Edge e) { return ((AbstractEdge)e).trg_; }
    
    public void bfs(Vertex root, Visitor vis)
    {
        var q = new LinkedList<Vertex>();
        var col = new HashMap<Vertex, Color>();
        
        vis.start(root);
        
        q.add(root);
        col.put(root, Color.grey);
        
        while(!q.isEmpty())
        {
            Vertex v = q.poll();
            
            switch(vis.vertex(v))
            {
            case accept:
                for(Edge e : outEdges(v))
                {
                    Color c = col.get(target(e));
                    
                    if(null == c) c = Color.white;
                    
                    Control res = vis.edge(e, c);
                    
                    if(Control.discard == res)
                    {
                        col.put(target(e), Color.black);
                        c = Color.black;
                    }
                    else if(Color.white == c)
                    {
                        col.put(target(e), Color.grey);
                        q.add(target(e));
                    }
                }
                break;
            case discard: break;
            }
            
            col.put(v, Color.black);
        }
        
        vis.finish();
    }
}

class ConcreteGraph<GraphProperty, VertexProperty, EdgeProperty>
    extends AbstractGraph<GraphProperty, VertexProperty, EdgeProperty>
{
    public class MyVertex extends AbstractVertex
    {
        private Vector<Edge> in_;
        private Vector<Edge> out_;
        
        public MyVertex(VertexProperty prop, int index__)
        {
            super(prop, index__);
            in_ = new Vector<Edge>();
            out_ = new Vector<Edge>();
        }
    }
    
    public class MyEdge extends AbstractEdge
    {
        public MyEdge(
            EdgeProperty prop,
            Vertex from,
            Vertex to,
            int index__)
        {
            super(prop, from, to, index__);
        }
    }
    
    public GraphProperty property;
    
    private Vector<Vertex> vertices_;
    private Vector<Edge> edges_;
    
    public ConcreteGraph(GraphProperty prop)
    {
        super(prop);
        vertices_ = new Vector<Vertex>();
        edges_ = new Vector<Edge>();
    }
    
    public Vertex addVertex(VertexProperty prop)
    {
        var V = new MyVertex(prop, vertices_.size());
        vertices_.add(V);
        return V;
    }
    
    public void removeVertex(Vertex v__)
    {
        var v = (MyVertex)v__;
        
        while(!v.out_.isEmpty())
        {
            var e = (MyEdge)v.out_.lastElement();
            
            edges_.remove(e.index_);
            
            for(var ee : edges_.subList(e.index_, edges_.size()))
            {
                ((MyEdge)ee).index_--;
            }
            
            ((MyVertex)e.trg_).in_.remove(e);
            
            v.out_.remove(v.out_.size()-1);
        }
        while(!v.in_.isEmpty())
        {
            var e = (MyEdge)v.in_.lastElement();
            
            edges_.remove(e.index_);
            
            for(var ee : edges_.subList(e.index_, edges_.size()))
            {
                ((MyEdge)ee).index_--;
            }
            
            ((MyVertex)e.src_).out_.remove(e);
            
            v.in_.remove(v.out_.size()-1);
        }
        
        vertices_.remove(v.index_);
        
        for(var vv : vertices_.subList(v.index_, vertices_.size()))
        {
            ((MyVertex)vv).index_--;
        }
    }
    
    public Edge addEdge(
        Vertex from__,
        Vertex to__,
        EdgeProperty prop)
    {
        var from = (MyVertex)from__;
        var to = (MyVertex)to__;
        
        var E = new MyEdge(prop, from__, to__, edges_.size());
        from.out_.add(E);
        
        try
        {
            to.in_.add(E);
        }
        catch(Throwable x)
        {
            from.out_.remove(from.out_.size()-1);
            throw x;
        }
        
        try
        {
            edges_.add(E);
        }
        catch(Throwable x)
        {
            from.out_.remove(from.out_.size()-1);
            to.in_.remove(from.in_.size()-1);
            throw x;
        }
        
        return E;
    }
    
    public void removeEdge(Edge e__)
    {
        MyEdge e = (MyEdge)e__;
        
        edges_.remove(index(e));
        
        for(var ee : edges_.subList(e.index_, edges_.size()))
        {
            ((MyEdge)ee).index_--;
        }
        
        ((MyVertex)e.src_).out_.remove(e);
        ((MyVertex)e.trg_).in_.remove(e);
    }
    
    public void clear()
    {
        vertices_.clear();
        edges_.clear();
    }
    public boolean isEmpty() { return vertices_.isEmpty(); }
    
    public int vertexCount() { return vertices_.size(); }
    public int edgeCount() { return edges_.size(); }
    
    public Collection<Vertex> vertices()
    {
        return java.util.Collections.unmodifiableCollection(vertices_);
    }
    public Collection<Edge> edges()
    {
        return java.util.Collections.unmodifiableCollection(edges_);
    }
    public Collection<Edge> inEdges(Vertex v)
    {
        return java.util.Collections.unmodifiableCollection(((MyVertex)v).in_);
    }
    public Collection<Edge> outEdges(Vertex v)
    {
        return java.util.Collections.unmodifiableCollection(((MyVertex)v).out_);
    }
    
    public int inDegree(Vertex v) { return ((MyVertex)v).in_.size(); }
    public int outDegree(Vertex v) { return ((MyVertex)v).out_.size(); }
}

class myvis extends Visitor
{
    Graph g;
    myvis(Graph gg) { g=gg; }
    
    public void start(Vertex root)
    {
        System.out.println("start");
    }
    public void finish()
    {
        System.out.println("finish");
    }
    
    public Control vertex(Vertex v)
    {
        System.out.println(g.index(v));
        return Control.accept;
    }
    public Control edge(Edge e, Color col)
    {
        System.out.println("" + g.index(e) + ": " + g.index(g.source(e)) + " -> " + g.index(g.target(e)) + " " + col);
        return Control.accept;
    }
}

class Test
{
    public static void main(String args[])
    {
        class foo {};
        Graph<foo, foo, foo> g = new ConcreteGraph<foo, foo, foo>(null);
        
        var a = g.addVertex(null);
        var b = g.addVertex(null);
        var c = g.addVertex(null);
        var d = g.addVertex(null);
        g.addEdge(a, b, null);
        g.addEdge(a, c, null);
        g.addEdge(c, d, null);
        g.addEdge(a, c, null);
        g.addEdge(a, c, null);
        g.addEdge(d, a, null);
        g.addEdge(d, d, null);
        
        g.bfs(a, new myvis(g));
    }
}

r/learnjava • • Apr 09 '21

Should you always use interface types (?) in Java?

42 Upvotes

(Correct my terminology if the title is wrong)

Not sure if the title makes sense. What I mean is when I want to use an ArrayList, or a HashSet, I could do:

ArrayList<Integer> myList = new ArrayList<>();
HashSet<Integer> mySet = new HashSet<>();

OR

List<Integer> myList = new ArrayList<>();
Set<Integer> mySet = new HashSet<>();

I feel like I've heard/seen people say to do the second one, because it makes it easier in the future if you want to change the type of list/set to a different type, and it will help with functions and stuff because if you have a function that returns a List instead of an ArrayList then you can easily change to a LinkedList for example and not have to change much code.

First off, is it the case that I should always (or even majority of the time) do the second way?

If yes, why? If not, why not?


r/learnjava • • Mar 31 '21

Advice for improving code quality

42 Upvotes

Hi guys, would like to apologise in advance if this is the wrong thread to post to. I was hoping to hear from your experiences on how did you all improve in coding in your own ways.

I just started my first back-end dev job and prior to that, I only had about 4 months of intensive Java training for this role. As a result, I would think that my experience with Java is not as much as most of my peers, and I quickly came to realise how actually WORKING with Java was a whole new experience and learning curve for me, as compared to just practicing it at home. Initially, I was quite proud of my work as they could all run as per requirements. After a while though, my code reviews kept leaving me really discouraged, with the many change requests from my supervisor in order to optimise my code. Recently, one of my managers also told me that I ‘really have to improve faster on my coding skills’. I later realised he was referring to how my code could adopt more best practices and be more efficient (e.g less calls to database, usage of String.join in 1 line rather than using StringJoiner, handling exceptions only when appropriate etc.)

I understand that such improvements usually come with experience, but are there also any other ways or practices that you guys had to speed up this learning curve to produce high quality code in your work?

EDIT: thanks so much for the tips and detailed reading recommendations! Would definitely look into those books, as well as to make the conscious effort to turn those tips into good coding habits as soon as possible.


r/learnjava • • Mar 21 '21

Learning backend development

42 Upvotes

I have more than 6 years of experience with working in Java and 2 years in kotlin as I mostly work on android professionally, I had done a course on udemy for spring boot and understood what's happening but there was a gap where spring boot seemed like a black box where you annotate and work is done by spring, can some suggest a way to learn backend where I learn fundamentals and how things work rather some magical annotations. I am open to online courses, books, blogs whatever I can get my hands on to learn the fundamental and how things work under the hood in spring.

Any help is appreciated, thank you.


r/learnjava • • Jan 06 '21

what is the best way to learn java

42 Upvotes

i mean what is the roadmap for a good java developer . so that i am employable with a good salary.

is learning scala or kotlin worth it ? at this point of time in my career.

and yeah i know that these are just tools to just solve a problem . but some tools have more priority than others , and i think java happens to be one .

i know basic c,c++,java,python and basic dsa. and i have roughly around 8 months before start for searching jobs

thanks in advance :)

edit:kotlin


r/learnjava • • Oct 13 '20

Pluralsight is free until Sunday. What are the best Java courses on there?

42 Upvotes

I'd like to learn as much as I can on Pluralsight this week. Any recommendations on good Java courses or something on there you would recommend?


r/learnjava • • Aug 06 '20

can you suggest some resources to learn Spring boot?

42 Upvotes

I wanna learn spring boot but I kinda didn't find quite the good content to do so, I don't wanna just sit there and listen to the long theory stuff I wanna practice so I can learn it does anyone know a good course or article that goes to straight to the thing?


r/learnjava • • Mar 14 '20

Updated my Tictactoe game. Feedback appreciated!

42 Upvotes

Hello, I created a post a few hours ago on this subreddit regarding a Tictactoe game which I had developed as part of my Hyperskill course curriculum. I received some great feedback on that post and have made some updates!

The main changes that I did are as follows :

1) Instead of a predefined 3 x 3 field, the game now can be played on a n x n field, based on the user input.

2) Used the Builder pattern to set a default value of 3 x 3 for the game field, since Java does not directly support default values for arguments, plus to practice design patterns :)

3) Removed the int array from the code.

I have tried to incorporate the many suggestions that I received on my previous post. I am unsure on a few points though, which are as follows :

  1. In the checkWinner() method, I have purposely created a boolean variable to return the state instead of directly returning true/false values. I did this to improve readability while I was coding and am unsure if it's fine or whether I should return true/false values.

  2. It was suggested that a separate Player class be introduced in the code. The Hyperskill curriculum directive was to assume that player X starts the game, and I have kept it as is. In the future I intend to support an automatic 1 player game, I will update the Player class at that point of time.

  3. Separation of contents - Honestly I am not sure how to implement this concept in my code. I do have a basic understanding of this concept but I unfortunately am unsure on how to proceed here. I'll be very thankful for any guidance or hints on this topic w.r.t. this updated repo.

I'd like to thank u/aqua_regis / u/desrtfx u/Ruttelisious and u/Hallsville3 for the fact that they took time and helped me with their feedback. Sorry if I missed anyone!

As always, suggestions or feedback would be greatly appreciated.

(Main.java -> tictactoe/run/Main.java. Other files are in their respective packages).