Java Practice Set 4
Java Practice Set 4 QUESTIONS --- SOLUTIONS/CODE --- package com.company ; import java.util.Scanner ; public class PS4 { public static void main (String[] args) { /* Q1 - What will be the output of this program: int a = 10; if (a=11){ System.out.println("I am 11"); } else{ System.out.println("I am not 11"); } ANSWER - This will simply throw an error because, in if statement, we used '=' as an assignment operator to run the program correctly, we should have use a logical operator '==' */ /* Q2 - Write a program to find out to whether a student is pass or fail; To pass it requires 40% of total marks and 33% marks of each subjects Assume 3 subjects and take marks as an input from the user */ byte s1 , s2 , s3 ; Scanner sc = new Scanner(System. in ) ; System. out .println( "Enter your marks in Physics"...