what does i stands in java?
Answers
Explanation:
The convention of using “i” for a ‘throwaway’ integer variable is very old.
It dates back to the 1952 version of the FORTRAN programming language, where declaring variables was optional - and (by default) all variables beginning with the letters ‘I’ through “N” were integers and all others were floats.
Hence if someone wanted an integer to control a loop or to count something - they’d just pick the first integer variable - which is ‘I’ (or sometimes the last…’N’), if they needed more than one, they’d use ‘i’, ‘j’ and then ‘k’ - but rarely ‘l’ because that looks like the digit ‘1’. Single letter variables are easier to type - and when you were limited to 80 characters on a punched card, brevity mattered!
That convention has carried on for 60+ years!
Some people say it stands for “index” or something like that - but that’s a “back-formation” to explain something with a much more mundane origin.
It’s sometimes claimed that ‘I’ and ’N’ were chosen because they were the first two letters of the word “integer”…I don’t know whether that’s true.
Some people claim that using ‘i’ for these purposes is poor practice and that a more descriptive name should be chosen - but it’s become so ingrained in the psyche of most programmers, that the name ‘i’ in itself carries meaning.
If I see a[i] = 5 ; - I’m going to strongly suspect that this line of code is inside a loop controlled by ‘i’.
If you instead use “count” or something, you’re actually diluting the meaning and typing more for less value.
But for chrissakes, don’t use ‘i’ for anything else! If you do, you’ll sow chaos and confusion all around!
Answer:
java is a high level programming language