Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

switch expressions

//called: switch expressions

int number= 2;

string result = number switch
{
    0 => "zero",
    1 => "one",
    2 => "two",
    _ => "default"
};

Console.WriteLine(result);
Comment

switch expression

switch(expression) {
    case value1:
        statement(s)
        break;
		
    case value2:
        statement(s)
        break;
		
	/* you can give any number of cases */
	
    default:
        statement(s)
}
Comment

PREVIOUS NEXT
Code Example
Java :: why is write replacing my text java 
Java :: okhttpconfig 
Java :: java add backslash into string 
Java :: how to open a folder in java swing project 
Java :: hasAuthority method not working with thymeleaf 
Java :: httpsession vs cookie servlet 
Java :: No data type for node: org.hibernate.hql.internal.ast.tree.IdentNode -[IDENT] IdentNode: 
Java :: Retrieve Image from java database. 
Java :: also in java 
Java :: java project with submodules 
Java :: add method in java 
Java :: why use var in java 
Java :: spring environment null pointer exception 
Java :: api for currency conversion free 
Java :: EuclideanAlgorithm in Java 
Java :: java singly linked list example 2 res 
Java :: how to add a command to a button java 
Java :: issue wsdl call java example 
Java :: spring boot rest api 
Java :: non access modifiers in java 
Java :: how to generate a random number in libgdx 
Java :: How to disable special characters on keyboard in android 
Java :: truncar a 2 decimales java 
Java :: default constructor java 
Java :: && java 
Java :: generic array creation java 
Java :: java tutorialspoint 
Java :: finding min and max from given number in java 
Java :: start an activity in adapter 
Java :: java string copy characters 
ADD CONTENT
Topic
Content
Source link
Name
8+2 =