Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Am i blind?????

  1. #1
    Junior Member
    Join Date
    Jan 2020
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Angry Am i blind?????

    I wrote and rewrote this code several times!
    I copied it from a video tutorial
    BUT i can not figure out why it does not let me access a method

    [code]

    package pachet;
    public class Main {
    public static void main(String[] args) {
    }
    int highScore = calulateHighScore(1500);

    displayHighScore("Alex",highScore);

    public static void displayHighScore(String playerName, int highScore){
    System.out.println(playerName+" managed to get into position " + highScore + " on the high score table");
    }
    public static int calulateHighScore(int playerScore) {
    if(playerScore > 1000){
    return 1;
    }else if (playerScore < 1000 && playerScore >500){
    return 2;
    }else if(playerScore <500 && playerScore >100){
    return 3;
    }else {
    return 4;
    }

    }
    }
    [code]
    I created the "displayHighScore" why can`t i access it.
    whith the second method it`s no problem, what am i doing wrong ??
    This really bugs me :(
    i wasted one day to figure it out and still cant do it

    i suspect the problem is elementary
    PS its my 2nd day on java

  2. #2
    Member
    Join Date
    Apr 2014
    Posts
    93
    Thanks
    3
    Thanked 7 Times in 7 Posts

    Default Re: Am i blind?????

    Your main() function is empty, and your statements to calculate and display are not inside any function.
    public static void main(String[] args) {
     int highScore = calulateHighScore(1500);
     displayHighScore("Alex",highScore);
    }

Similar Threads

  1. java and blind users
    By micam001 in forum Member Introductions
    Replies: 1
    Last Post: June 27th, 2011, 03:27 AM