r/javahelp • u/Dependent_Finger_214 • Dec 29 '25
Unsolved Advance ZonedDateTime by Duration
So, I have a ZonedDateTime and a Duration (as in, the java.time.Duration class), and I need to advance the DateTime by the duration. How can I do that?
r/javahelp • u/Dependent_Finger_214 • Dec 29 '25
So, I have a ZonedDateTime and a Duration (as in, the java.time.Duration class), and I need to advance the DateTime by the duration. How can I do that?
r/javahelp • u/Forsaken-Screen7873 • Aug 16 '25
.
r/javahelp • u/Whole-History9210 • Mar 28 '26
Im trying to download x64 DMG Installer Java JDK 26 on my macbook air version 10.14.6 with 1.8 GHz Intel Core i5 processor. I have tried downloading it a few times but each time I type:
/usr/libexec/java_home
/usr/libexec/java_homein terminal it comes up with this:
Unable to find any JVMs matching version "(null)".
Matching Java Virtual Machines (0):
Default Java Virtual Machines (0):
No Java runtime present, try --request to install.
Please help!
r/javahelp • u/[deleted] • Aug 19 '26
Hey, I want to learn java web development. I know java programming at intermediate level by solving leetcode problems... I want to become a java developer. Guide me guys... Help me out... I am a final year student trying for placement but I didn't believe that I will be placed suggest me a roadmap too
r/javahelp • u/MasterpieceHot218 • Dec 12 '24
Efficient Container Stacking Algorithm - Practice Problem
I'm working on a problem related to algorithm design and would appreciate any help or suggestions. Here’s the scenario:
In a commercial port, goods are transported in containers. When unloading a ship at the terminal, it's crucial to use the smallest possible surface area. To achieve this, the containers need to be stacked optimally.
We have N containers (numbered from 1 to N), all with the same dimensions. For each container, we are given:
Its weight.
Its maximum load capacity (i.e., the total weight it can support on top of it).
The goal is to stack as many containers as possible in a single pile while respecting these constraints:
A container can only be placed directly on top of another.
A container cannot be placed on top of another with a larger serial number.
The total weight of all containers placed on top of a container cannot exceed that container’s maximum load capacity.
The number of containers, N (1 ≤ N ≤ 800).
For each container, two integers: its weight (wᵢ ≤ 5000) and its maximum load capacity (cᵢ ≤ 5000).
The maximum number of containers that can be stacked.
The serial numbers of the containers in ascending order that form the pile.
Input:
21
168 157
156 419
182 79
67 307
8 389
55 271
95 251
72 235
190 366
127 286
28 242
3 197
27 321
31 160
199 87
102 335
12 209
122 118
58 308
5 43
3 84 Output:
Number of containers: 13
Container 2
Container 4
Container 5
Container 6
Container 8
Container 11
Container 12
Container 13
Container 14
Container 17
Container 19
Container 20
Container 21 What is the most efficient algorithm to solve this problem for values of N up to 800? Any advice or suggestions would be greatly appreciated!
r/javahelp • u/Nolive_Dc • Jan 20 '25
Yo im trying to make a discord balls dex. But i dont know how to make it with rarity and how it chosen one of the random cards... I want it so it chosen a random card if smbody uses /spawn
r/javahelp • u/googly_eyes29 • Aug 09 '24
Hello. Learning DSA for the first time. Have this doubt.
r/javahelp • u/Business-Break8182 • Aug 23 '24
Hi. Newbie programmer here, i want to install eclipse and i searched abt it a found a vid 4 years ago smth that u need jdk , and other vids says u need just the eclipse
r/javahelp • u/NickTheMuffin • Jul 27 '24
Where do i get Java 8 from? Java.com or from the Oracle.com archives???
r/javahelp • u/hajer00317 • Aug 25 '24
What is the output of this code? double X=2.1; if (++x == 3) { double y= 2.0; System.out.print(x + y); } else System.out.print(x);
They say the answer is 3.1. But my answer is 2.1 since the condition of if statement did not go through. Can someone explain?
r/javahelp • u/[deleted] • Nov 03 '20
I have a UML diagram which outlined how to write the code , including animal super class with private fields name size and breed. The subclass cat has an overloaded constructor which gives error Animal.name is not visible.
Constructor looks like
public Cat(String name, String breed, int size){
this.name = name;
this.breed = breed;
this.size = size;
} I tried changing it to setName(name); but that wouldn’t work does anyone have any ideas sticking to private fields and overloaded constructor as per the instructions
r/javahelp • u/Moltenmelt1 • Sep 26 '20
import java.util.Scanner;
public class Assign2 {
public static void main(String[] args) {
// Create a Scanner
Scanner input = new Scanner(System.in);
// Prompt the user to enter filing status
System.out.print("(0-single filer, 1-married jointly or " +
"qualifying widow(er), 2-married separately, 3-head of " +
"household) Enter the filing status: ");
int status = input.nextInt();
// Prompt the user to enter taxable income
System.out.print("Enter the taxable income: ");
double income = input.nextDouble();
// Compute tax
double tax = 0;
if (status == 0) { // Compute tax for single filers
if (income <= 8350)
tax = income * 0.10;
else if (income <= 33950)
tax = 8350 * 0.10 + (income - 8350) * 0.15;
else if (income <= 82250)
tax = 8350 * 0.10 + (33950 - 8350) * 0.15 +
(income - 33950) * 0.25;
else if (income <= 171550)
tax = 8350 * 0.10 + (33950 - 8350) * 0.15 +
(82250 - 33950) * 0.25 + (income - 82250) * 0.28;
else if (income <= 372950)
tax = 8350 * 0.10 + (33950 - 8350) * 0.15 +
(82250 - 33950) * 0.25 + (171550 - 82250) * 0.28 +
(income - 171550) * 0.33;
else
tax = 8350 * 0.10 + (33950 - 8350) * 0.15 +
(82250 - 33950) * 0.25 + (171550 - 82250) * 0.28 +
(372950 - 171550) * 0.33 + (income - 372950) * 0.35;
}
else if (status == 1) { // Compute tax for married file jointly
if (income <= 16700)
tax = income * 0.10;
else if (income <= 67900)
tax = 16700 * 0.10 + (income - 16700) * 0.15;
else if (income <= 137050)
tax = 16700 * 0.10 + (67900 - 16700) * 0.15 + (income - 67900) * 0.25;
else if (income <= 208850)
tax = 16700 * 0.10 + (67900 - 16700) * 0.15 +
(137050 - 67900) * 0.25 + (income - 137050) * 0.28;
else if (income <= 372950)
tax = 16700 * 0.10 + (67900 - 16700) * 0.15 +
(137050 - 67900) * 0.25 + (208850 - 137050) * 0.28 +
(income - 208850) * 0.33;
else
tax = 16700 * 0.10 + (67900 - 16700) * 0.15 +
(137050 - 67900) * 0.25 + (208850 - 137050) * 0.28 +
(372950 - 208850) * 0.33 + (income - 372950) * 0.35;
}
else if (status == 2) { // Compute tax for married separately
// Left as exercise
if (income <= 8350)
tax = income * 0.10;
else if (income <= 33950)
tax = 8350 * 0.10 + (income - 8350) * 0.15;
else if (income <= 68525)
tax = 8350 * 0.10 + (33950 - 8350) * 0.15 + (income - 33950) * 0.25;
else if (income <= 104425)
tax = 8350 * 0.10 + (33950 - 8350) * 0.15 + (68525 - 33950) * 0.25 + (income - 68525) * 0.28;
else if (income <= 186475)
tax = 8350 * 0.10 + (33950 - 8350) * 0.15 + (68525 - 33950) * 0.25 + (104425 - 68525) * 0.28 +
(income - 104425) * 0.33;
else
tax = 8350 * 0.10 + (33950 - 8350) * 0.15 + (68525 - 33950) * 0.25 + (104425 - 68525) * 0.28 +
(income - 104425) * 0.33 + (income - 186475) * 0.35;
}
else if (status == 3) { // Compute tax for head of household
// Left as exercise
if (income <= 11950)
tax = income * 0.10;
else if (income <= 45500)
tax = 11950 * 0.10 + (income - 11950) * 0.15;
else if (income <= 117450)
tax = 11950 * 0.10 + (45500 - 11950) * 0.15 + (income - 45500) * 0.25;
else if (income <= 190200)
tax = 11950 * 0.10 + (45500 - 11950) * 0.15 + (117450 - 45500) * 0.25 + (income - 117450) * 0.28;
else if (income <= 372950)
tax = 11950 * 0.10 + (45500 - 11950) * 0.15 + (117450 - 45500) * 0.25 + (190200 - 117450) * 0.28 +
(income - 190200) * 0.33;
else
tax = 11950 * 0.10 + (45500 - 11950) * 0.15 + (117450 - 45500) * 0.25 + (190200 - 117450) * 0.28 +
(income - 190200) * 0.33 + (income - 372950) * 0.35;
}
else {
System.out.println("Error: invalid status");
System.exit(1);
}
// Display the result
System.out.println("Tax is " + (int)(tax * 100) / 100.0);
}
}
}
r/javahelp • u/DazzlingDisplay2294 • Sep 21 '22
Hi, if anyone can answer this, that would be absolutely great! So there are problems in my code in Eclipse. I need to debug my code/file step-by-step. And it does -- it executes the program line by line each time I hit enter (just like Java Visualizer). However, it starts going into inbuilt classes as well... (e.g. Object class) that's too much detail. I need the step-by-step aid to remain ONLY in my code/file. How can we do that? Thanks much!!!
r/javahelp • u/No-Emphasis9355 • Apr 12 '21
As an inexperienced and self-taught java learner, I have to say I need some guidance. After trying to do this before and then doing some research I have some questions. To anyone who is able to read to the end and answer this post I greatly appreciate your time and input, because I really need help/ a mentor.
Considering I don’t have a computer science degree I imagine my credentials will fall under what I upload to GitHub. So, I have some questions about that. Is it okay for potential employees to just see your programming logic? For example, when I made a poker program, I used print statements so I could see if the logic code I made was working to simulate a real poker game. I had a lot of fun making this and considering on GitHub you can just see the code I was hoping that could be enough.
I know as a programmer you never stop learning and I’m happy to continue to expand my knowledge, but I think I really need to get some work experience/feedback to have a more realistic conceptual understanding of what it takes to be a competent programmer and if this is the path for me. I try to study between 8-12 hours a day, so I am willing to put the time in, but I am struggling with motivation because I’m struggling to understand what I need to know.
For example, there is a java masterclass on Udemy made by Tim and apparently, you can become job-ready with that but what I’m unclear on is how? Unless what I said above counts and if you write complex code without a GUI or option to actually store data (basically not a functional program in the real world but sort of technically works in an IDE)
It has been recommended to me and I have looked into areas such as Hibernate, SQL, MySQL (should I still learn MySQL, since PostgreSQL exists now?), Servlets & JSP, XML, HTML, Spring(and spring boot), and JDBC, however in investigating these areas I am not sure which ones to focus on first. I am also worried about the different versions available. I try to follow tutorials online but run into incompatibility problems a lot. I also see a lot of comments where java developers working in the field say they have not worked with the newer versions of let’s say spring boot or spring 5. It seems each of these areas regardless will take a long time to understand and implement (I’ve read it can take a month or so for each and apparently there are lots of different areas to some that are not always relevant. I think I read somewhere that some online course material that teaches things like the various spring frameworks don’t teach you concepts that are relevant or useful in the workforce) so I have doubts on where to proceed. Also, Tim’s Udemy course doesn’t cover any of this (except some SQL) which makes me wonder then how those people claim to have found jobs? Even read some comments online that people found java jobs after completing the MOOC FI Helsinki course for java which I also completed and most of Tim’s course.
So far if my assumption is correct, Hibernate is for databases and JDBC is for connecting to the database server and link it to your IDE so you can view/manipulate the data. So, you don’t use it to make applications. Only to interact with data. I tried experimenting in eclipse and learned some MySQL and JDBC following Telusko tutorial on YouTube and followed his videos on Servlets and JSP which are basically the nuts and bolts of connecting and creating a website with java. As far as I see there are 2 paths which are web or app development. To be honest I don’t really care which I do, at least at this stage. I just want to write programming logic but am interested in design and make my own apps. I considered learning java swing to make desktop apps to help me practice new code better but worried about the time that would take to learn (for right now with my goals)
When I’m not coding, I think about the code a lot and how to improve and look at other people’s code for inspiration. Java is very versatile, and I want to learn it all but that will come with time and for now, I need to direct my focus specifically and focus on well rounding myself later. Spring/spring-boot appears very web developer-focused. So, I don’t know if I should learn spring first or android studio. Hibernate seems kind of boring but I’ll learn it if I have to. The reason I say this is because I can make applications/ visual programs with swing and android studio for the web or smartphones/tablets. Plus, I am thinking it would look better for an employer. Because of the factor of time, I debated if I should learn swing or JavaFX because it’s for desktops and while I could use it to make a functional interactive program outside the IDE, I get the impression it’s not used a lot?
I am getting frustrated a lot wondering if I made the wrong choice learning java because I see a lot of people are gravitating towards python/kotlin (or I see so many posts or video suggestions of people becoming web developers in 3 months) and I’ve spent 3 months learning java, so I want to use it. I have a couple of friends who are developers however one is a web developer who mains in JavaScript and the other is a back-end developer who hates java and both of them don’t know any Java developers so I’m unable to get any insight from anyone in the profession. I’m seriously debating if I should make a complete dramatic shift and stop java and spend 3 months learning JavaScript/Html/CSS, not because it’s easier but because that path is more specific because it’s all about web development so what’s needed to learn is more straight forward and structured and less confusing. I’ve heard JavaScript developers have to keep learning new dependency things but so what? There is so much to learn around java as well but at least it looks like I could start working while learning sooner with JavaScript. I am very reluctant to make that change because I don’t want to feel like I wasted 3 months learning java.
I am a full-time student right now but I’m only in my current study to get the points I need to go to uni. Despite having other responsibilities, I could still split my time with 8 hours or more a day learning java and the rest on studies though sometimes I had to take a break from programming for a week during exam weeks. I will not be attending university starting this September though so I’ll have a “gap year” if you can call it that. I am 25 years old and for personal reasons have been unable to find sustainable work and the prospect of working from home/ by myself was the initial appeal, but I was drawn in by being creative with rules and logic and making the computer do things. I’m happy to spend all day coding. I really want to be able to support myself so that’s also why time is a bit of a factor.
Honestly, something like a video call would be great to discuss this in more detail.
r/javahelp • u/Dantes_Sin_of_Greed • May 03 '21
Last part of an assignment I am work on. Creating an English language calculator. Need to translate user input of numbers from 0-9 to the words "zero, one, two, etc..." Must use a switch case to do so.
Switch Case Translate Numbers/Digits into Words
Currently, stuck on how to store the data to use it later. Posted below is the section of my code that I am stuck on. Any tips or advice would be greatly appreciated, thank you!
r/javahelp • u/way3344 • Mar 24 '21
I'm doing an IO question, I'm pretty new to this, but it asks me to "Make readFile() tell the compiler it will not handle any thrown checked exceptions". If you need me to elaborate more let me know, but the question itself starts off with this so I don't think it needs more elaboration. Thanks for help in advance.
r/javahelp • u/Veebhu_does_finance • Mar 10 '21
Hi guys I am tryna make a java program with quadratic equation, but I don't know how to implement the equation into java, can someone help me?
r/javahelp • u/thermicresist • Apr 10 '17
I need to fulfill these requirements with my assignment:
At least 2 classes. More than 3 methods More than 3 objects Inheritance Overloading and Overriding. Constructors and Constructors with parameters. Abstract Classes
Do you have an idea of what I could make to fulfill these scenarios.
r/javahelp • u/laxrat45 • Feb 07 '15
I have a project due and not exactly sure where to start. "Each line in the file contains the name, year released, and associated actors for one movie. Each piece of information is separated by ‘/’ characters. The year is specified inside parentheses at the end of the movie name.
create a class which represents a Movie Database. This class is required to have the following methods (it may have other additional methods as necessary):
loadDataFromFile( String aFilename ) read the information from the specified file. The format of the file will be the same as in the cast-mpaa.txt file.
findActorsIn( String movieName ) return an ArrayList of all the actors which star in the specified Movie.
findMovieAppearancesOf( String actorName ) return a new Movie Database containing all movies which star the specified actor.
findMoviesReleasedIn( int year ) return a new Movie Database containing all movies released in the specified year.
findMoviesWithNamesContaining( String word ) return a new Movie Database containing all movies whose title contains the specified word.
findActorsWithNamesContaining( String word ) return an ArrayList containing the names of all actors which contain the specified word. There should not be duplicate names in the returned ArrayList.
size() return the number of movies contained in the Movie Database.
toString() return a string representation of all of the information in the Movie Database."
r/javahelp • u/MinnyMan123 • Feb 04 '18
I have tried looking at other resources but have been unable to convert this to a while loop. Any tips or help would be appreciated.
public static void main(String[] args) { String[] arr1 = { "1st", "2nd", "3rd", "4th", "5th" };
String[] arr2 = { "6th", "7th", "8th", "9th", "10th" };
String str = "Hello";
int i, j;
for (i = 0; i < 5; i++)
{
for (j = 0; j <= i; j++)
System.out.print("*");
System.out.println(" " + arr1[i] + " " + str);
}
for (i = 9; i >= 5; i--)
{
for (j = 5; j <= i; j++)
System.out.print("*");
System.out.println(" " + arr2[9 - i] + " " + str);
}
}}
r/javahelp • u/DumbledoraTheFordExp • Oct 18 '15
I have no clue how to use Java but I need to add my class and my partners class together. I made the sad GUI and I want his Tic-Tac-Toe implementation to be in my Panel labled panelGame. Heres my part
import javax.swing.; import java.awt.; import java.awt.event.ActionEvent; import java.awt.event.ActionListener;
public class CardLayoutTutorial { JFrame frameMain = new JFrame("Tic-Tac-Toe"); JPanel panelContainer = new JPanel(); JPanel panelMenu = new JPanel(); JPanel panelGame = new JPanel(); JButton buttonOne = new JButton("Start Game"); JButton buttonSecond = new JButton("Back to Menu"); JLabel labelGameTitle = new JLabel("Tic-Tac-Toe"); CardLayout cl = new CardLayout();
public CardLayoutTutorial() {
panelContainer.setLayout(cl);
panelMenu.add(labelGameTitle);
panelMenu.add(buttonOne);
panelGame.add(buttonSecond);
panelMenu.setBackground(Color.BLUE);
panelGame.setBackground(Color.GREEN);
panelContainer.add(panelMenu, "1");
panelContainer.add(panelGame, "2");
cl.show(panelContainer, "1");
buttonOne.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
cl.show(panelContainer, "2");
}
});
buttonSecond.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
cl.show(panelContainer, "1");
}
});
frameMain.add(panelContainer);
frameMain.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frameMain.pack();
frameMain.setVisible(true);
frameMain.setSize(600, 500);
}
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
new CardLayoutTutorial();
}
});
}}
My partners part
import javax.swing.; import java.awt.; import java.awt.event.*;
public class TicTacToe implements ActionListener{
//A board and 9 buttons
JFrame board = new JFrame("TicTacToe");
JButton button1 = new JButton("");
JButton button2 = new JButton("");
JButton button3 = new JButton("");
JButton button4 = new JButton("");
JButton button5 = new JButton("");
JButton button6 = new JButton("");
JButton button7 = new JButton("");
JButton button8 = new JButton("");
JButton button9 = new JButton("");
String letter = "";
boolean win = false;
int steps = 0;
public TicTacToe(){
board.setLayout(new GridLayout(3,3));
board.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
board.setResizable(false);
board.setMinimumSize(new Dimension(600,500));
board.setMaximumSize(new Dimension(600,500));
board.getContentPane().add(button1);
button1.addActionListener(this);
board.getContentPane().add(button2);
button2.addActionListener(this);
board.getContentPane().add(button3);
button3.addActionListener(this);
board.getContentPane().add(button4);
button4.addActionListener(this);
board.getContentPane().add(button5);
button5.addActionListener(this);
board.getContentPane().add(button6);
button6.addActionListener(this);
board.getContentPane().add(button7);
button7.addActionListener(this);
board.getContentPane().add(button8);
button8.addActionListener(this);
board.getContentPane().add(button9);
button9.addActionListener(this);
board.setVisible(true);
}
public void actionPerformed(ActionEvent a){
steps++;
//Odd-th number of steps will always be a nought, Even-th number of steps will always be a cross
if(steps % 2 == 1){
letter = "O";
}
else{
letter = "X";
}
//Actually setting the letter on the button and disable the button
if(a.getSource() == button1)
{
button1.setText(letter);
button1.setEnabled(false);
}
else if(a.getSource() == button2)
{
button2.setText(letter);
button2.setEnabled(false);
}
else if(a.getSource() == button3)
{
button3.setText(letter);
button3.setEnabled(false);
}
else if(a.getSource() == button4)
{
button4.setText(letter);
button4.setEnabled(false);
}
else if(a.getSource() == button5)
{
button5.setText(letter);
button5.setEnabled(false);
}
else if(a.getSource() == button6)
{
button6.setText(letter);
button6.setEnabled(false);
}
else if(a.getSource() == button7)
{
button7.setText(letter);
button7.setEnabled(false);
}
else if(a.getSource() == button8)
{
button8.setText(letter);
button8.setEnabled(false);
}
else if(a.getSource() == button9)
{
button9.setText(letter);
button9.setEnabled(false);
}
//Checking if 3 in a row has be reached
if(button1.getText().equals(button2.getText()) && button2.getText().equals(button3.getText()) && button1.getText() != "")
{
win=true;
endGame(letter);
}
else if(button4.getText().equals(button5.getText()) && button5.getText().equals(button6.getText()) && button4.getText() != "")
{
win=true;
endGame(letter);
}
else if(button7.getText().equals(button8.getText()) && button8.getText().equals(button9.getText()) && button7.getText() != "" )
{
win=true;
endGame(letter);
}
//Checking if 3 in a column has be reached
else if(button1.getText().equals(button4.getText()) && button4.getText().equals(button7.getText()) && button1.getText() != "")
{
win=true;
endGame(letter);
}
else if(button2.getText().equals(button5.getText()) && button5.getText().equals(button8.getText()) && button2.getText() != "")
{
win=true;
endGame(letter);
}
else if(button3.getText().equals(button6.getText()) && button6.getText().equals(button9.getText()) && button3.getText() != "")
{
win=true;
endGame(letter);
}
//Checking if 3 in a diagonal line has been reached
else if(button1.getText().equals(button5.getText()) && button5.getText().equals(button9.getText()) && button1.getText() != "")
{
win=true;
endGame(letter);
}
else if(button3.getText().equals(button5.getText()) && button5.getText().equals(button7.getText()) && button3.getText() != "")
{
win=true;
endGame(letter);
}
//Tie game
if(steps == 9 && win == false){
JOptionPane.showMessageDialog(null, "Tie Game!", "Stale Mate", JOptionPane.PLAIN_MESSAGE);
System.exit(0);
}
}
public void endGame(String name){
JOptionPane.showMessageDialog(null, letter + " Wins!", "Congratulations!", JOptionPane.PLAIN_MESSAGE);
System.exit(0);
}
public static void main(String[] args){
new TicTacToe();
}}
r/javahelp • u/TheFloulYt • Jan 11 '21
im coursing a game dev course and the first language its java making experiments to create an entity database for games im getting this error when i call a function see this
Entity.java
package oo;
public class Entity {
String SNAME[];
int SLIFE[];
int SDAMAGE[];
public void create(int UEID , String Name , int life , int damage) {
System.out.println( Name + " has start entity started in UUID " + UEID + "logged on ");
SNAME[UEID] = Name;
SLIFE[UEID] = life;
SDAMAGE[UEID] = damage;
}
public void damage(int UEIDtakingDamage , int UEIDdoingDamage) {
SLIFE[UEIDtakingDamage] =- SDAMAGE[UEIDdoingDamage];
if (SLIFE[UEIDtakingDamage] <= 0) {
System.out.println(SNAME[UEIDtakingDamage] + " has dead by taking a damage of" + SNAME[UEIDdoingDamage]);
}
}
}Main.java
package oo;
public class Main {
public static void main(String[] args) {
Entity Obj = new Entity();
Obj.create(1, "Vitm", 100, 25);
Obj.create(2, "Assasin", 1000, 250);
Obj.damage(1, 2);
}
}Console when run Main.java
Vitm has as Player started in UUID 1logged on
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
at oo.Entity.create(Entity.java:8)
at oo.Main.main(Main.java:6)im newbie in java so pwease no be angry with me by the wrong code im typed
r/javahelp • u/[deleted] • Jan 15 '21
I tried this for loop:
public void weaponInventoryMenu ()
{
for (int i = 0 ; i < weaponInventory.size() ; i++)
{
System.out.println("Weapon Inventory: " + weaponInventory.get() + " ") ;
}
}But I only get a memory address.
r/javahelp • u/biggrabo • Jan 21 '21
Hi,
I need to adjust an array in his inside.
So if the array is
int []array={5,5,5,5,5,5,0,5,5,5,5,5,5,0} And i pick array[2]
I need the array[2] to become 0 and the other than add +1 5 times to the next one
So the result should be
array={5,5,0,6,6,6,1,6,5,5,5,5,5,0}
Can someone help me out please :/