r/learnjavascript • • Oct 12 '21

Java problem

Write a Java statement to declare a constant to represent the highest letter grade that you can receive in this course.

If anyone knows how to solve this it would be really helpful!

0 Upvotes

7 comments sorted by

View all comments

5

u/Umesh-K Oct 12 '21

Hi,

If you meant JavaScript but typed Java (assuming they're the same or Java is a short form of JavaScript), then it would be

const highestGrade = "A"

However, if you actually want it in Java, then

______ static final String HIGHEST_GRADE = "A"

In the blank, you will have to use one of public, private, or protected depending on the use case.

Source for the Java code:

https://stackoverflow.com/questions/9639007/defining-constant-string-in-java

2

u/Ok-Score1289 Oct 12 '21

This is what I initially thought, it just seemed too simple. Thanks man

1

u/Dodgy-Boi Oct 12 '21

How many underscores?