class TernaryOperator
{
public static void main(String args[])
{
(10>20)?10:20;
}
}
is this code is valid ?
Output:
D:\Java8>javac TernaryOperator.java
TernaryOperator.java:6: error: not a statement
(10>20)?10:20;
^
1 error
You Should assign value for TernaryOperator.
Modified code :
class TernaryOperator
{
public static void main(String args[])
{
int a=(10>20)?10:20;
}
}
{
public static void main(String args[])
{
(10>20)?10:20;
}
}
is this code is valid ?
Output:
D:\Java8>javac TernaryOperator.java
TernaryOperator.java:6: error: not a statement
(10>20)?10:20;
^
1 error
You Should assign value for TernaryOperator.
Modified code :
class TernaryOperator
{
public static void main(String args[])
{
int a=(10>20)?10:20;
}
}
Comments
Post a Comment