Answers for "assert is in java or python"

0

how to use assert in python

assert type(num) is int,"num must be an integer"
Posted by: Guest on September-07-2020
0

java assert

public static void main(String[] args) {
        int a = 6;
        assert a != 6 : "a != 6";
    }
//Exception in thread "main" java.lang.AssertionError: a != 6

Foo result = null;
assert result != null;

final int result = a + b;
assert (result - a == b) : "Sum of " + a + " + " + b + " returned wrong sum " + result;
Posted by: Guest on October-20-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language