Play audio slide show -- Keyboard shortcut: 'x'  Lecture overview -- Keyboard shortcut: 'u'  Previous page: Increment, decrement og assignment operatorer i Java -- Keyboard shortcut: 'p'  Next page: Input output og programstrukturering [Section] -- Keyboard shortcut: 'n'  Lecture notes - all slides and notes together  Annotated slide -- Keyboard shortcut: 't'  Alphabetic index  Help page about these notes  Course home  Play sound for this slide -- Keyboard shortcut: 'y'    De ikke objekt-orienterede dele af Java - slide 32 : 39

Den betingede operator i Java 

logiskUdtryk ? udtryk1 : udtryk2
 

 

static int fak(int n){
   return 
     n == 0 ? 1 : n * fak(n-1);
 }
 

static int fak1(int n){
   if (n == 0)
     return 1;
   else return n * fak1(n-1);
 }