@BellBottomBlues not a stupid question at all, I remember asking my officers how they refer to officers when I first entered.
So I'll use Bing's moment at the end of his post as an example:
"Sir."
"Lieutenant."
"Officer."
"Sir."
As you seem to know already, enlisted always call officers by either their ranks (Commander, Captain, Lieutenant), with a simple "Sir" or "Ma'am", or if they are a doctor then most prefer to actually be called by "Dr. Bill" because, and I quote, "I worked far too hard for this to be called sir".
The only off thing in what Bing wrote is "Officer" that will never be said, no one calls an Officer by officer, they'd probably take it disrespectfully and give you an ass chewing depending where you work.
Officers on the other hand can be a bit more lax with each other. The officers I work with range from Lieutenat to Commander (O-3 to O-5) and are on a first name basis with each other. But to people they don't directly work with they tend to use their rank no matter if they are above or below them just out of common courtesy.
You only salute outside, wearing some sort of cover (cover <- Hat or cranial <-- What anyone that works on a flight deck says they wear it's not a helmet) and accompany it with a greeting. In a ship you only give a greeting to an officer once as you first see them and clear the hall by moving to the wall to let them pass, every subsequent encounter you can just not greet but still move over (this also applies to higher ranked enlisted, E-7 to E-9, but only for other enlisted). The only person you must always greet on a ship is the CO no matter if it's your first time seeing them or your fifteenth the CO of the ship always gets a greeting.
Lower ranked officers salute higher ranked officers while in uniform outside with some sort of headwear on, they also go by the same rule above for greetings shipboard.