output:
Student Jack Frost with ID 1 has a final grade of 73.0
You failed. Study more please
To call a non static field 73.0
Student Santa Claus with ID 2 has a final grade of 92.0
You passed! Yehey
To call a static field 2
The non static field named "instanceVariable_StudentID" was equaled to a static field which is "staticVariable_StudentNumber". I can named the static field as the student ID directly but i did not since i find it wrong. Student ID is unique for each student. Each student has each own ID while on the otherhand, the student number can be a variable that is common to all since a student number can be a general category. I think the best way to define it is to give a sample. Like for instance a cellphone, its phone number can be the student id because every phone has its own number while the student number is the branch of the telecommunication where your phone belongs. View it like this:
PhoneNumber Globe Smart
+63916 - 1234567 1
+63917 - 1234567 2
+63918 - 1234567 1
+63919 - 1234567 2
StudentId = PhoneNumber;
StudentNumber = either Globe or Smart
Globe ============================> StudentNumber
+63916 - 1234567 1 =========================> ID 1
+63917 - 1234567 2 =========================> ID 2
StudentNumber is the category and the ID1 and ID2 are the elements under it.
This "staticVariable_StudentNumber" is initilized inside the contructor "DifferentKindsOfVariables(String parameter1){}". staticVariable_StudentNumber++ is just equaled to "staticVariable_StudentNumber = staticVariable_StudentNumber + 1". It only means that every time an object is created, the "staticVariable_StudentNumber" increments to one. Remember to be declared static, there should only be one variable in existence no matter how many objects were created. We have two objects,objectReference_Student1 and objectReference_Student2 and this "staticVariable_StudentNumber" is counting every objects that were created from the same class.
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
/* MEANING OF THE WORD */
private - fields can be accessed only within the class. That is why we created a method for setting and getting the fields that was declared public. Therefore we can used the object to call the method. Note that there are also methods and class that are declared private.
public - fields can be accessed by other class. Same procedure of creating an object and then call it.
constuctor - is just like a method but with the same name as of the class. it can have an arguments or none. It is usually used to initialize fields.
set and get - set and get is a technique used to the methods to accessed fields that are declared private.
control flow statements - are decison making statements. We provide the condition and how it is outputted in different paths. Like for example the if and else. it is read like, if the condition is true, output this value otherwise if condition is false, you output this value. And there are more control flow statements like this.
YOU ARE READING
Java codes i learned online
RandomThis is just my notes to record everything i learned about java. You can read it if you want.. You can correct me if i am wrong but please do not be too harsh on me. i am just a newbie in programming. I will start schooling this July 15, 2019.. and...
Variables
Start from the beginning
