r/learnjava • u/[deleted] • Sep 29 '19
community
Hey guys! I made a community for people interested in competitive programming!
subreddit: r/competitivprogramming
discord: https://discord.gg/FubWtfe
r/learnjava • u/[deleted] • Sep 29 '19
Hey guys! I made a community for people interested in competitive programming!
subreddit: r/competitivprogramming
discord: https://discord.gg/FubWtfe
r/learnjava • u/holle197 • Sep 24 '19
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 • u/Objective-Ad8508 • Oct 05 '22
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 94My 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 • u/[deleted] • Oct 09 '22
PROBLEM SOLVED thanks to
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!
r/learnjava • u/[deleted] • Oct 22 '22
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 • u/Extension_Tie_2427 • Oct 25 '22
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 • u/vasu1996 • Nov 20 '19
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 • u/AutumnAced • Jan 27 '23
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 • u/ThatGuyThatIsNotReal • Sep 25 '21
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 • u/Willy988 • Sep 02 '21
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 • u/carrombolt • Aug 23 '22
i=20; j=30; System.out.println(i+++j); \\output 50 System.out.println(j); \\ output 30
r/learnjava • u/Advanced-Ad6007 • Jul 31 '22
I couldn't chance here and i think this is more understandable:
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;}
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.");}}
public String graduation_average(double rate) {
return "Average "+rate;} //Problem is probably here but i do not know what...
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..");}
}
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 • u/Ashutosh_1003 • Aug 12 '22
Please suggest me good resources for Core Java, Advanced Java and Spring boot.
r/learnjava • u/One-Program3580 • Jan 10 '22
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 • u/FitAd981 • Apr 13 '23
`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 • u/[deleted] • Sep 12 '16
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 • u/Ambitious-Curve-5837 • Sep 08 '23
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 • u/TheLearnedGoat • Sep 19 '23
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 • u/michaellarsen91 • Mar 02 '15
Does anyone know of a sub dedicated to programming android with Java
r/learnjava • u/[deleted] • May 18 '16
r/learnjava • u/CDXXnoscope • Sep 17 '18
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?