Skip to content
Advertisement

Tag: arraylist

How to Insert Data To Array

I want to save a “AromaNorm” into NormalisasiT1 array, but i had a error : AWT-EventQueue-0 java.lang.NullPointerException Can you help me? Here the Code Answer you should initialize the array the array is null so it throws NPE.

Java/Processing: A* graph node based game

I am trying to build a little ‘simulation’ game. This game has no real purpose, I am just making small little projects while I try and learn the in’s and out’s of some beginner programming. This is my goal: On the processing canvas, there are multiple ‘Nodes’ that represent where a player can move to. The user will input where

Sum int values in unsorted ArrayList based on dates

I’ve got a list of objects with LocalDateTime and int fields. Here is an example of an object from the list: How to check whether a sum of ints on a certain date (multiple entries for the same date possible) does not exceed some value for O(n) or better? forEach loop must be used, sorting is restricted. Answer I’ve done

Constructor in a for loop

I’ve a beginner at java programming and I’ve been tasked at creating a database. The database is a bike store with a super class Bike and sub classes mountain bike, road bike. I also have a class …

Java Bubble Sort String ArrayList Object

Can someone find why this isn’t being sorted I can’t seem to find what I have wrong? The output that is being displayed is how I input them after each other thus the sort method isn’t working… Answer There are three errors: 1. It does i++ instead of i+1. i++ means: return i then increment its value. So t1 and

Advertisement