Click here to Skip to main content
15,884,176 members
Home / Discussions / Java
   

Java

 
AnswerRe: java jshell beanshell eval string Pin
jschell5-Sep-21 8:55
jschell5-Sep-21 8:55 
QuestionDefault Casting a column to type using Hibernate Pin
ficevivu3-Aug-21 19:50
ficevivu3-Aug-21 19:50 
QuestionHow to make a scrolling background for a JPanel in java? Pin
Mr.Corona13-Jul-21 1:51
Mr.Corona13-Jul-21 1:51 
QuestionRe: How to make a scrolling background for a JPanel in java? Pin
Richard MacCutchan13-Jul-21 2:37
mveRichard MacCutchan13-Jul-21 2:37 
AnswerRe: How to make a scrolling background for a JPanel in java? Pin
Mr.Corona13-Jul-21 2:41
Mr.Corona13-Jul-21 2:41 
GeneralRe: How to make a scrolling background for a JPanel in java? Pin
Richard MacCutchan13-Jul-21 2:46
mveRichard MacCutchan13-Jul-21 2:46 
GeneralRe: How to make a scrolling background for a JPanel in java? Pin
Mr.Corona13-Jul-21 2:53
Mr.Corona13-Jul-21 2:53 
GeneralRe: How to make a scrolling background for a JPanel in java? Pin
Richard MacCutchan13-Jul-21 3:04
mveRichard MacCutchan13-Jul-21 3:04 
GeneralRe: How to make a scrolling background for a JPanel in java? Pin
Mr.Corona13-Jul-21 3:40
Mr.Corona13-Jul-21 3:40 
GeneralRe: How to make a scrolling background for a JPanel in java? Pin
Richard MacCutchan13-Jul-21 5:02
mveRichard MacCutchan13-Jul-21 5:02 
GeneralRe: How to make a scrolling background for a JPanel in java? Pin
Mr.Corona13-Jul-21 17:55
Mr.Corona13-Jul-21 17:55 
QuestionHow to read a certificate from USB Token and Print It on Eclipse Console?? Pin
Member 150264029-Jul-21 0:59
Member 150264029-Jul-21 0:59 
QuestionKnowing about jdk Pin
Ranjeet Singh from Unknown7-Jul-21 21:56
Ranjeet Singh from Unknown7-Jul-21 21:56 
AnswerRe: Knowing about jdk Pin
Richard MacCutchan7-Jul-21 22:08
mveRichard MacCutchan7-Jul-21 22:08 
QuestionJava Pin
Ranjeet Singh from Unknown7-Jul-21 21:54
Ranjeet Singh from Unknown7-Jul-21 21:54 
AnswerRe: Java Pin
Richard MacCutchan7-Jul-21 22:07
mveRichard MacCutchan7-Jul-21 22:07 
GeneralRe: Java Pin
Ranjeet Singh from Unknown7-Jul-21 22:12
Ranjeet 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
Ranjeet Singh from Unknown7-Jul-21 23:39 
AnswerRe: Java Pin
jschell17-Jul-21 10:57
jschell17-Jul-21 10:57 
QuestionHow to use additional parameters inside ConstraintValidator.isValid method Pin
Harpia3-Jul-21 6:36
Harpia3-Jul-21 6:36 
AnswerRe: How to use additional parameters inside ConstraintValidator.isValid method Pin
Member 1528896314-Jul-21 0:30
Member 1528896314-Jul-21 0:30 
QuestionHow to change Java Persistence.createEntityManagerFactory()? Pin
Rocking Kapil21-Jun-21 2:10
Rocking Kapil21-Jun-21 2:10 
QuestionDifficulty searching element in an Array Pin
sifuyipe14-Jun-21 3:58
sifuyipe14-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
Emmanuel Guerrero9-Jun-21 10:03 

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.