Unlike instance variables, class variables are the same across the class and all instances of the class. They can be set from anywhere, but they change across the board in all instances. Continue reading “Java Variables Example 2 –Class Variables”
Instance Variables (Non-Static Fields) Technically speaking, objects store their individual states in “non-static fields”, that is, fields declared without the
statickeyword. Non-static fields are also known as instance variables because their values are unique to each instance of a class (to each object, in other words); the
currentSpeedof one bicycle is independent from the
In the following sample code, we set up a class. This class will be referenced in our application. This class has two instance variable members, speed and gear. While each bike shares a variables named speed and gear each instance has its own variable, with its own place in memory and value. Continue reading “Java Variables Examples 1 – Instance Variables”
Capital not Capitol.
Angular has some great built in filters, but one case that comes up the Angular doesn’t handle automatically capitalizing the first letter in a string. (Skip to the bottom to get the code snippet if you don’t care about my babbling)
For capitalizing the first letter, but leaving the rest of the string the same, we’ll use the substring, toLowerCase and toUpperCase methods.
I’m assuming you have a module set up, I’m using the app convention.