20th Sep 2020, 4:29 PM
Gamer Stream
Gamer Stream - avatar
4 Answers
+ 3
public class Program { public static void main(String[] args) { String a = "Minecraft"; switch(a){ case "Pubg": System.out.println("hello"); break; case "Minecraft": System.out.println("Nice game"); break; default: System.out.println("Not in my list"); } } }
20th Sep 2020, 4:31 PM
Muhammadamin
Muhammadamin - avatar
+ 2
Write string inside "
20th Sep 2020, 4:32 PM
Muhammadamin
Muhammadamin - avatar
+ 2
šŸ‡®šŸ‡³OmkaršŸ•‰ you are right thanks
20th Sep 2020, 4:42 PM
Muhammadamin
Muhammadamin - avatar
+ 1
Muhammadamin , In Java, We can't use single quote ' for strings. It's used for characters. String literals require double quotes ". It's not same as Python or JS.
20th Sep 2020, 4:40 PM
šŸ‡®šŸ‡³OmkaršŸ•‰
šŸ‡®šŸ‡³OmkaršŸ•‰ - avatar