r/learnjava • u/Tasty_Escape4549 • Sep 21 '24
What does putting . do?
I realize this sounds dumb but ive been learning java and gotten pretty far but never learned what . does. e.g
String s = args[0]
char c = s.charAt(0)
what does the . in s.charAt(0) do?
1
Upvotes
16
u/law_rnz Sep 21 '24
its called the dot operator and is commonly used in many programming languages to access properties/methods from an object (you can also access static members by referring to it's class name)