Instance Variables (Non-Static Fields) Technically speaking, objects store their individual states in “non-static fields”, that is, fields declared without the static keyword. 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 currentSpeed of one bicycle is independent from the currentSpeed of another.
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”→
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.