Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

252
Views
Why there is no compilation error when I am using different data types for switch expression and case value in this case
public class Conditionsif {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        int day=1;
        switch(day){
        case '1':
            System.out.println("Monday");
            break;
        
        }
        
    }

}

There is no compilation error in above though switch expression is integer data type and case value is character

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Its because of implicit casting ascii value of a is 97

 switch(97){
           case 'a': System.out.println("a"); break;
           case 'b': System.out.println("b"); break;
           case 'c': System.out.println("c"); break;
 }
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!