Search:

Type: Posts; User: Mr.777

Search: Search took 0.07 seconds.

  1. Replies
    70
    Views
    7,991

    Re: JD1's Personal Development Blog

    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...
  2. Replies
    70
    Views
    7,991

    Re: JD1's Personal Development Blog

    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
  3. Replies
    70
    Views
    7,991

    Re: JD1's Personal Development Blog

    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...
  4. Replies
    70
    Views
    7,991

    Re: JD1's Personal Development Blog

    No need to say thanks. That's why, we are here at forums, to help everyone.
  5. Replies
    70
    Views
    7,991

    Re: JD1's Personal Development Blog

    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...
  6. Replies
    70
    Views
    7,991

    Re: JD1's Personal Development Blog

    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...
  7. Replies
    70
    Views
    7,991

    Re: JD1's Personal Development Blog

    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 + "...
  8. Replies
    70
    Views
    7,991

    Re: JD1's Personal Development Blog

    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...
  9. Replies
    70
    Views
    7,991

    Re: JD1's Personal Development Blog

    class Example{
    private int total;
    public int getTotal(){
    return total;
    }
    public void setTotal(int total){
    this.total = total;
    }

    public static void main(String... args){
  10. Replies
    70
    Views
    7,991

    Re: JD1's Personal Development Blog

    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).
  11. Replies
    70
    Views
    7,991

    Re: JD1's Personal Development Blog

    There are also third type of comments and they are Java Doc Comments.
  12. Replies
    70
    Views
    7,991

    Re: JD1's Personal Development Blog

    @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...
  13. Replies
    70
    Views
    7,991

    Re: JD1's Personal Development Blog

    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...
Results 1 to 13 of 13