Results 1 to 1 of 1
Thread: Airthmetic statement shortcuts
-
Airthmetic statement shortcuts
There are different ways of writing arithmetic statements.
It has no affect on the performance as long as left hand side variable does not require computation. If left hand side variable requires computation, then short form is ideal.Java Code:i = i + 1; i+= 1; // shortcut i = i/2; i /= 2; // shortcut i = i*2; i *= 2; // shortcut i = i-1; i -= 1; // shortcut
Java Code:myArray[getCurrentndex()] = myArray[getCurrentndex()] + 1; // getCurrentndex() is called 2 times myArray[getCurrentndex()] += 1; // getCurrentndex() is called once
Similar Threads
-
How to use XML-based configuration metadata shortcuts
By Java Tip in forum Java TipReplies: 0Last Post: 03-30-2008, 10:06 AM -
How to prevent keyboard shortcuts when a dialog is open?
By sajad.ar in forum SWT / JFaceReplies: 0Last Post: 01-21-2008, 01:29 PM -
How to use XML-based configuration metadata shortcuts
By JavaBean in forum Java TipReplies: 0Last Post: 09-26-2007, 08:38 PM -
Toolbar Settings And Shortcuts In NetBeans IDE
By JavaForums in forum NetBeansReplies: 0Last Post: 08-02-2007, 12:11 PM -
Statement or Prepared Statement ?
By paty in forum JDBCReplies: 3Last Post: 08-01-2007, 04:45 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks