Java Variables Examples 1 – Instance Variables

Instance Variables Flow Chart
What is an instance variable? A class member that each instance of the class inherits, each containing an independent value from the same member in other instances.

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.

Referencing Java Certification Tutorial, Section 1-1 Variables

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”

Capitalization of First Letter in Angular with a Custom Filter (And JavaScript generally too).

Capitalization of First Letter in Angular with a Custom Filter (And JavaScript generally too).
Capitalization of First Letter in Angular with a Custom Filter (And JavaScript generally too).

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.

The regular JavaScript for capitalizing goes like this: Continue reading “Capitalization of First Letter in Angular with a Custom Filter (And JavaScript generally too).”