0

I know this maybe a silly question I'm quite confuse about them, as I understand this example has 1 line of code and 2 line of text.

1. System.out.print("-----------
2. ----------------------------"};

Am I right or wrong?

JasonMArcher
  • 14,195
  • 22
  • 56
  • 52
Xitrum
  • 7,765
  • 26
  • 90
  • 126
  • depends on how it's counted. usually, tools like `wc -l` count this as 2 lines, since they don't bother to parse the actual syntax. – Vlad Oct 19 '12 at 19:44
  • so literally, they are different? – Xitrum Oct 19 '12 at 19:45
  • well, how would you define "line of code"? example: `if (cond) f();` can be typeset in one or two physical lines -- how many lines of code would it be in either case? – Vlad Oct 19 '12 at 19:46
  • eg. when we use debugging tool, the above example is a line of code, a completed and meaningful sentence... – Xitrum Oct 19 '12 at 19:48
  • 1 line of code? and what about `if (cond) { f(); }`, which is usually split into 4 lines of text -- is it still 1 line of code? – Vlad Oct 19 '12 at 19:49
  • to me, i understand them as 02 line of codes.. what do you think ? – Xitrum Oct 19 '12 at 19:50
  • well, there are always corner cases, like comma operator in C++ or lambda expression in C#. I would say, the LOC is mostly meaningless. – Vlad Oct 19 '12 at 19:52
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/18316/discussion-between-aptos-and-vlad) – Xitrum Oct 19 '12 at 19:54

1 Answers1

0

For java I usually define lines of code as the number of non-text semi-colons and right parenthesis.

Chris Gerken
  • 16,221
  • 6
  • 44
  • 59