r/learnjava • • Sep 29 '19

community

0 Upvotes

Hey guys! I made a community for people interested in competitive programming!

subreddit: r/competitivprogramming

discord: https://discord.gg/FubWtfe


r/learnjava • • Sep 24 '19

Socket

1 Upvotes

Imagine i made java app with 2 class. Server and client. What i need to do if i want connect to my server using my app if i go to my neighbord house and on his computer? How do that?


r/learnjava • • Oct 05 '22

Java ( getting average grade )

0 Upvotes

What's wrong with my code?

I have a text file which includes student names and grades. I am trying to read the grades and put them into a 2d array in a separate method. Then I want to call the name and get the student grade in the output file.

Input File

Tyroh 78 67 98 90 89 
Wesley 80 99 89 97 90 
Jane 67 89 77 80 94

My code:

import java.io.*;
import java.util.Scanner; 
    public class GradeofStudent {
    public static void main(String[] args) throws FileNotFoundException
    {
        
        Scanner inFile = new Scanner (new FileReader("Input File"));
        PrintWriter outFile = new PrintWriter("Output File");
        String[] fname = new String[3];
        String[] lname = new String[3];
        int[] score = new int[5];
        int sum = 0;
        double average = 0;
        
            for (int a=0; a<3; a++) 
            {
                fname[a]=inFile.next();
                lname[a]=inFile.next();
                
                outFile.println("\n"+fname[a]+" "+lname[a]);
            }
            for (int i=0; i<5; i++)
            {   
                score[0]=inFile.nextInt();
                score[1]=inFile.nextInt();
                score[2]=inFile.nextInt();
                score[3]=inFile.nextInt();
                score[4]=inFile.nextInt();
                
                outFile.println(score[0]+"\t"+score[1]+"\t"+score[2]+"\t"+score[3]+"\t"+score[4]/5);
                outFile.println("Your Average is: "+average);

                System.out.println("End of the program. Check output file for the results");
                inFile.close();
                outFile.close();
            }
    }
    
}

r/learnjava • • Oct 09 '22

Help needed!!

1 Upvotes

PROBLEM SOLVED thanks to

NautiHooker

https://www.baeldung.com/java-tostring

I'm trying to complete a project for class and running out of time. I need to create a dealership inventory program but I'm having issues. The main one is that the arraylist does not seem to be working. Please if anyone can look it over and help it would be greatly appreciated!

https://pastebin.com/wXjuGP45


r/learnjava • • Oct 22 '22

Please someone help me set up a Java environment. I want to learn Java.

1 Upvotes

Starting from the JDK file I have to download. I have a 2016 MacBook Pro.

I want to learn two languages Python and Java, is this realistic?

What books in Java do you recommend?


r/learnjava • • Oct 25 '22

What does this method really do

0 Upvotes

I have always used this code and I am not sure what it really does especially dealing with the o

public int compareTo(BasketballPlayer o) {

return averagePPG - this.averagePPG;

}

What does the o mean in the code. I know its a method but I do not know how it is different from the a normal method thats like

public int compareTo() {

return averagePPG - this.averagePPG;

}


r/learnjava • • Nov 20 '19

Sources to Learn Java from Scratch?

0 Upvotes

Hello guys, I am complete newbie to programming and I am really interested in learning Java. Can you let me know some good easily understandable material for an absolute beginner?

TIA :)


r/learnjava • • Jan 27 '23

How to create a factorial in Java

1 Upvotes

Hi everyone, I was wondering if any of you guys can point me in the right direction when it comes to creating a factorial in Java specifically for the MOOC Helsinki because it's asking me for it but I've read all of the text regarding this (which is not much, if anything) so I don't know if they want it a specific way if there's more than one way to do it. Can anybody who has completed the exercise or knows how about it point me in the right direction on where to look for the solution for this? Thanks!

Update: The result came back as " Your program was trying to read too much user input, remember to use nextLine()!." But it makes no sense because I put "

int number = Integer.valueOf(scanner.nextLine());" which includes the nextLine() in it, so now I'm honestly even more confused now...


r/learnjava • • Sep 25 '21

Calling all numbers?

0 Upvotes

I would like to call all numbers to restrict the input to be only numbers? What is the best way to do this?


r/learnjava • • Sep 07 '21

How would you write this maths formula in java?

1 Upvotes

r/learnjava • • Sep 02 '21

Realistically, can Java do any cool things like making bots?

0 Upvotes

I'm still in year one of college, but I am really interested in bots. I know Python is the way to go, but I know nothing about it. Curious if it's doable with Java? I know it is possible but not conveniently especially for a novice.


r/learnjava • • Aug 23 '22

Why pre increment has no effect in this case?

1 Upvotes

i=20; j=30; System.out.println(i+++j); \\output 50 System.out.println(j); \\ output 30


r/learnjava • • Jul 31 '22

Hello, my method doesn't return me any value and i can not find why. I just started learning so it takes time.The method name is graduation_average i also tried to convert from double value to String but i could not find why.

0 Upvotes

I couldn't chance here and i think this is more understandable:

https://pastebin.com/S9DtxN8Z

My Main Class

public class Main {public static void main(String[] args){

MechanicalEngineer engineer2=new MechanicalEngineer(true,false);

String[] experience={};String[] reference={"Walter White","Jessie Pinkman"};

engineer2.criminal_record_check();

engineer2.military_service();

engineer2.graduation_average(5)//This one doesn't return any value.

;engineer2.experience(experience);

engineer2.bring_references(reference);

engineer2.graduation_average((12.5));

}}

My interface

public interface IEngineer {void military_service();

String graduation_average(double rate);

void criminal_record_check()

;void experience(String[] array);}

My MechanicalEngineering class

public class MechanicalEngineer implements IEngineer{

private boolean military_service;

private boolean criminal_record;

public MechanicalEngineer(boolean military_service, boolean criminal_record) {

this.military_service = military_service;

this.criminal_record = criminal_record;}

u/Override

public void military_service() {

if(military_service){System.out.println("The military service has beencompleted.");}

else{System.out.println("The compulsory military service is compulsory.");}}

u/Override

public String graduation_average(double rate) {

return "Average "+rate;} //Problem is probably here but i do not know what...

u/Override

public void criminal_record_check() {

if(criminal_record){

System.out.println("There is register on criminal record...");}

else{

System.out.println("The criminal record is empty..");}

}

u/Override

public void experience(String[] array) {

if(array.length==0){

System.out.println("I don't have any experience.");

}

else{

System.out.println("I have worked in those companies: ");

for(int i=0;i<array.length;i++){

System.out.println(array[i]);}

}

}public void bring_references(String array[]){

if(array.length==0){

System.out.println("I don't have any references");

}

else {

System.out.println("My references are: ");

for(int i=0;i<array.length;i++){

System.out.println(array[i]);}}

}}

The intellij idea prints:

The criminal record is empty..

The military service has been completed.

I don't have any experience.

My references are:

Walter White

Jessie Pinkman


r/learnjava • • Aug 12 '22

Java resources

0 Upvotes

Please suggest me good resources for Core Java, Advanced Java and Spring boot.


r/learnjava • • Jan 10 '22

Tim Buchalka's Java Programming MasterClass Discord - Looking for peers

1 Upvotes

If anyone is taking Tim Buchalka's Java Class on Udemy and would like to meet people taking the course as well, I made a discord that we can connect on. https://discord.gg/jwzYmgtCrq - I'm currently on the concurrence section, and the discord is just a very basic way that we can all get in contact. I would say join the discord no matter what level you are at in the course. It would be great to talk to fellow programmers on the same journey, because so far I have been on my own isolated path. Hope to hear from some people!


r/learnjava • • Apr 16 '23

TMC beans freaking out HELP

0 Upvotes

r/learnjava • • Apr 13 '23

why if (count == 2) { return i; } whats the point of it

1 Upvotes
`public static int second_symbol(String str, char c) {`

	`//DO YOUR MAGIC!!`

int count = 0;

for (int i = 0; i < str.length(); i++) {

if (str.charAt(i) == c) {

count++;

if (count == 2) {

return i;

}

}

}

return -1;

`}`

r/learnjava • • Sep 12 '16

Freaking desktop went down ... where can I practice from my tablet?

1 Upvotes

Prob my video card.

Anyway, beginner. Working through my learn java in 21 days. On day 6, kicking ass and taking names. Were talking understabding multi dimensional arrays and shit here.

Anyway, want to fuck around a bit, and my machine just ate shit. Anywhere I can fuck around a bit online in an emulator of some sort?

Edit: or on my android phone?

Thanks!


r/learnjava • • Sep 08 '23

Becoming a developer

1 Upvotes

Is it possible to become a developer or engineer without going to college or to get a degree. Basically with online courses or self learning. I was looking into Udemy as it’s not so expensive as bootcamps since I don’t have a high income job.


r/learnjava • • Sep 19 '23

How do I create a java app in linux?

1 Upvotes

I'd like to write a daily expenses manager java app using vscode on linux mint.

I'm positive i can write the code and all, but how do I make it so it's a "complete" app? By complete i mean i can launch it from an icon or terminal and it will register changes.

I'd really appreciate if you could provide some tutorial or article.


r/learnjava • • Mar 02 '15

Android java subreddit

1 Upvotes

Does anyone know of a sub dedicated to programming android with Java


r/learnjava • • May 13 '16

Convert an int to a String in java

Thumbnail
programtalk.com
0 Upvotes

r/learnjava • • May 18 '16

Issue with a code on TMC. Some assistance would be welcome.

Thumbnail
imgur.com
1 Upvotes

r/learnjava • • Sep 17 '18

I have about a week to code a few java lines to show my future boss that i know the basics of coding.

1 Upvotes

Hi, i'm currently in university and i study computer science, and already finished an apprenticeship in software development ( only in SAP so basically we only used ABAP ). I mean ofc i have made a shitty website or a shitty app before, but i basically only know the very basics of java ( stuff you pick up ddoing the mooc.fi tutorial and 1-2 little group projects in uni ) ...

i am currently trying to get a student employee job in software development in our company ( i am already working in the company for 6 years but not in IT ). So today i had a job interview for the new position, and the CTO told me to send him a little bit of code in the next week or two. So i desperately need a little project so i can show him in a few lines of code that i understood the basics of java. Do y'all have any suggestions?