Click here to Skip to main content
15,444,571 members
Home / Discussions / Java
   

Java

 
GeneralRe: Java Pin
Ranjeet Singh from Unknown7-Jul-21 22:12
MemberRanjeet Singh from Unknown7-Jul-21 22:12 
GeneralRe: Java Pin
Richard MacCutchan7-Jul-21 22:39
mveRichard MacCutchan7-Jul-21 22:39 
GeneralRe: Java Pin
Ranjeet Singh from Unknown7-Jul-21 23:39
MemberRanjeet Singh from Unknown7-Jul-21 23:39 
AnswerRe: Java Pin
jschell17-Jul-21 10:57
Memberjschell17-Jul-21 10:57 
QuestionHow to use additional parameters inside ConstraintValidator.isValid method Pin
Harpia3-Jul-21 6:36
MemberHarpia3-Jul-21 6:36 
AnswerRe: How to use additional parameters inside ConstraintValidator.isValid method Pin
Member 1528896314-Jul-21 0:30
MemberMember 1528896314-Jul-21 0:30 
QuestionHow to change Java Persistence.createEntityManagerFactory()? Pin
Rocking Kapil21-Jun-21 2:10
MemberRocking Kapil21-Jun-21 2:10 
QuestionDifficulty searching element in an Array Pin
sifuyipe14-Jun-21 3:58
Membersifuyipe14-Jun-21 3:58 
Been messing around for hours and eventually decided to seek the assistance of the internet.

I am trying to make a program where I/the user can add elements into an array (Name, age gender). Once elements have been added to the array, I want to then be able to search a String (name) to find the desired name I am after in the array. The context of the program is adding Climbers to a Climber Database (just an array) of who has climbed what mountain (haven't attempted adding the mountain stuff yet).

In what I've written so far, I keep getting the return null, saying that the searched String cannot be found. I have a feeling that I am failing to pass the parameters of the added element in the array.
For example, I add a 'climber' with the name John, 19, Male in the Climber Class. I then go to the ClubStats class to getClimber and search "John", the only one in the array and I receive a null..

FYI I am using BlueJ here so at a serious basic level.

Java
/**
 * Write a description of class Climber here.
 *
 * @author (your name)
 * @version (a version number or a date)
 */
public class Climber
{
    // Instance variables.
    // The climber name.
    private String name;
    // The climber age.
    private int age;
    // The climber gender.
    private String gender;
 
    /**
     * Constructor for objects of class Climber
     */
    public Climber(String newName, int newAge, String newGender)
    {
        // Initialise instance variables.
        name = newName;
        age = newAge;
        gender = newGender;
    }

QuestionNeed help figuring out why I got a java.lang.NullPointerException. Pin
Emmanuel Guerrero9-Jun-21 10:03
MemberEmmanuel Guerrero9-Jun-21 10:03 
AnswerRe: Need help figuring out why I got a java.lang.NullPointerException. Pin
OriginalGriff9-Jun-21 10:04
mveOriginalGriff9-Jun-21 10:04 
GeneralRe: Need help figuring out why I got a java.lang.NullPointerException. Pin
Emmanuel Guerrero9-Jun-21 13:37
MemberEmmanuel Guerrero9-Jun-21 13:37 
QuestionHow should the code, which is the answer to this question, be over the eclipse application in java language? Pin
Özde AKSOY31-May-21 8:43
MemberÖzde AKSOY31-May-21 8:43 
AnswerRe: How should the code, which is the answer to this question, be over the eclipse application in java language? Pin
Richard MacCutchan31-May-21 9:13
mveRichard MacCutchan31-May-21 9:13 
QuestionI developed a multiplayer game on my own for the past 6 months Pin
JimieSitu16-May-21 19:00
MemberJimieSitu16-May-21 19:00 
AnswerRe: I developed a multiplayer game on my own for the past 6 months Pin
OriginalGriff16-May-21 19:11
mveOriginalGriff16-May-21 19:11 
AnswerRe: I developed a multiplayer game on my own for the past 6 months Pin
SeanChupas17-May-21 3:00
MemberSeanChupas17-May-21 3:00 
AnswerRe: I developed a multiplayer game on my own for the past 6 months Pin
Gerry Schmitz17-May-21 8:00
mveGerry Schmitz17-May-21 8:00 
AnswerRe: I developed a multiplayer game on my own for the past 6 months Pin
digital seo201128-Jun-21 6:13
Memberdigital seo201128-Jun-21 6:13 
Questionhelp figuring out where my code went wrong please Pin
MollyJanet13-May-21 8:32
MemberMollyJanet13-May-21 8:32 
AnswerRe: help figuring out where my code went wrong please Pin
Victor Nijegorodov13-May-21 9:38
MemberVictor Nijegorodov13-May-21 9:38 
AnswerRe: help figuring out where my code went wrong please Pin
Dave Kreskowiak13-May-21 11:04
mveDave Kreskowiak13-May-21 11:04 
GeneralRe: help figuring out where my code went wrong please Pin
SeanChupas14-May-21 2:58
MemberSeanChupas14-May-21 2:58 
AnswerRe: help figuring out where my code went wrong please Pin
Richard MacCutchan13-May-21 21:02
mveRichard MacCutchan13-May-21 21:02 
AnswerRe: help figuring out where my code went wrong please Pin
SeanChupas14-May-21 3:00
MemberSeanChupas14-May-21 3:00 
Questionneed help in javaFX + Maven project structure Pin
Preantas3-May-21 8:50
MemberPreantas3-May-21 8:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.