What will be printed out as a result of the following code execution:
static bool Method1() 
      Console.WriteLine("in Method1"); 
      return false; 
static bool Method2() 
     Console.WriteLine("in Method2"); 
     return true; 
static void Main(string[] args) 
     if (Method1() && Method2()) 
       Console.WriteLine("inside if"); 

@ftaeml `Method2` in not executed because `Method1` returned `false`. It will be executed only if `Method1` returns `true` - that's how && (AND) operator works in the most programming languages

2020 Feb 16, 12:47:29 AM

@ftaeml you can check it here: https://ideone.com/JUSqrN

2020 Feb 16, 12:44:34 AM

I don`t agree,because Method2 executed too.

2020 Jan 8, 1:39:28 PM

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Sign Up Now
or Subscribe for future quizzes