Reiz Prērijā
Apslēptās Karaļvalsts Sargi

OCA Java SE 8 Programmer I Certification Guide by Mala Gupta


OCA Java SE 8 Programmer I Certification Guide by Mala Gupta

Author:Mala Gupta
Language: eng
Format: epub
Publisher: Manning Publications


A:10

C:10

A:20

B:29

C:249

F:249

5.1.2. Missing else blocks

What happens if you don’t define the else statement for an if construct? It’s acceptable to define one course of action for an if construct as follows (omitting the else part):

boolean testValue = false; if (testValue == true) System.out.println("value is true");

But you can’t define the else part for an if construct, skipping the if code block. The following code won’t compile:

But an empty code block that follows if works well:

boolean testValue = false; if (testValue == true) {} else System.out.println("value is false");



Loading...
Download




Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.