Attitude Editing Alight Motion || Controll Statements In Java || Technical Sham

 



  नमस्कार मित्रांनो Technical Sham च्या एका नवीन आणि इंटरेस्टिंग ब्लॉग मध्ये तुमचे सहर्ष स्वागत आहे. 

हॅलो फ्रेंड्स या ब्लॉगमध्ये तुम्हाला Java प्रोग्रामिंग बद्दल शिकायला भेटेल तसेच माझे  YouTube चैनल आहे, त्यामध्ये मी व्हिडिओ एडिटिंग करतो त्यासाठी जे काही मटेरियल आहे ते तुम्हाला या साईट वरती मिळून जाईल खाली डाउनलोड ऑप्शन मिळेल स्क्रोल करा तिथून तुम्ही हे सर्व मटेरियल डाउनलोड करून घ्या तर जर तुम्ही Programmers/Codder असाल तर फक्त प्रोग्रामिंग Content कडे लक्ष द्या आणि जर एडिटर असाल तर खाली मटेरियल दिला असेल मटरेल दिला आहे तिथून तुम्ही म्हटले डाऊनलोड करा.

Scroll Now 👇🏻👇🏻


Controll Statements In Java

                Aprogramming language uses control statements to cause the flow of execution to advance and branch based on changes to the state of a program. Java’s program control statements can be put into the following categories: selection, iteration, and jump. Selection statements allow your program to choose different paths of execution based upon the outcome of an expression or the state of a variable. Iteration statements enable program execution to repeat one or more statements (that is, iteration statements form loops). Jump statements allow your program to execute in a nonlinear fashion. All of Java’s control statements are examined here.

Java’s Selection Statements :

            Java supports two selection statements: if and switch. These statements allow you to control the flow of your program’s execution based upon conditions known only during run time. You will be pleasantly surprised by the power and flexibility contained in these two statements.


IF - Statement :

            The if statement was introduced in Chapter 2. It is examined in detail here. The if statement is Java’s conditional branch statement. It can be used to route program execution through two different paths. Here is the general form of the if statement: if (condition) statement1; else statement2; Here, each statement may be a single statement or a compound statement enclosed in curly braces (that is, a block). The condition is any expression that returns a boolean value. The else clause is optional. The if works like this: If the condition is true, then statement1 is executed. Otherwise, statement2 (if it exists) is executed. In no case will both statements be executed. For example, consider the following:

 int a, b;

 // ... 

if(a < b) 

a = 0; 

else b = 0;


Here, if a is less than b, then a is set to zero. Otherwise, b is set to zero. In no case are they both set to zero. 

        Most often, the expression used to control the if will involve the relational operators. However, this is not technically necessary. It is possible to control the if using a single boolean variable, as shown in this code fragment:

        Remember, only one statement can appear directly after the if or the else. If you want to include more statements, you’ll need to create a block, as in this fragment:

Here, both statements within the if block will execute if bytesAvailable is greater than zero.         Some programmers find it convenient to include the curly braces when using the if, even when there is only one statement in each clause. This makes it easy to add another statement at a later date, and you don’t have to worry about forgetting the braces. In fact, forgetting to define a block when one is needed is a common cause of errors. For example, consider the following code fragment:

            It seems clear that the statement bytesAvailable = n; was intended to be executed inside the else clause, because of the indentation level. However, as you recall, whitespace is insignificant to Java, and there is no way for the compiler to know what was intended. This code will compile without complaint, but it will behave incorrectly when run. The preceding example is fixed in the code that follows:
 

int bytesAvailable;
//..
if (bytesAvailable > 0) 

    ProcessData(); 
    bytesAvailable -= n; 
} else { 
    waitForMoreData(); 
    bytesAvailable = n; 
}

Thank You !!!






Editing Friends  You Can Download Our Materials For Free !!!


Join Telgram Channel :-

सर्व मटेरियल साठी खाली download करा... 👇







Only Editing Friends खालील व्हिडिओ पुर्ण बघा. 👇🏻





मित्रांनो आपल्याला Instagram वरती नक्की follow करा.


FOLLOW ON INSTAGRAM 

SUBSCRIBE YOUTUBE CHANNEL


Thanks For Visit My Website.. 🙏


Post a Comment

Previous Post Next Post