Well it's the convention from the Sun. Also, it is used to let others understand that we are going to have an array of that datatype named this. Like
int[] arrayName;
The code will let others...
Type: Posts; User: Mr.777
Well it's the convention from the Sun. Also, it is used to let others understand that we are going to have an array of that datatype named this. Like
int[] arrayName;
The code will let others...
No, just declaring an array.
So, if you want to have a reference to an array you will most likely be;
int[] arrayTest;
arrayTest = new int[SIZE];
OR
Though this method of declaring and creating an array is not wrong but the right convention is to use the syntax like;
These minor suggestions are just to improve your programming style as you are...
No need to say thanks. That's why, we are here at forums, to help everyone.
1. You must know the difference between static and non static methods.
2. I will recommend you to write main() as a separate class instead of mixing it in the already written class. Because your...
You are in Class1 and class1Object is actually the object of Class1 so, outside main() why do you need to use this object?
You can call or use any of instance variable or method of Class1 as far as...
After getting the number of grades, you are not actually calling the loop() to let your program get input from the users for grades.
System.out.println("You've chosen to average " + numGrades + "...
Yeah they are marked with red underline because they are not initialized. And also they are local variables not instance variables. Only instance variables get auto initialized. You must initialize...
class Example{
private int total;
public int getTotal(){
return total;
}
public void setTotal(int total){
this.total = total;
}
public static void main(String... args){
Make the total as Instance variable and use getTotal() as getters method of your class so that you could use it anywhere and mark total as private(if it's instance variable).
There are also third type of comments and they are Java Doc Comments.
@OA-OD-JD1: Though you are learning Java but you must need to know the naming conventions for variables, constants, methods, classes, interfaces etc....
So, follow the Sun naming conventions in...
No, braces don't really effect efficiency but the actual thing is if you are too beginner, don't just leave using braces whether it's a single statement as mentioned by others, this can in the end...