Tutorialspoint

ES6 Number.isFinite()

var res = Number.isFinite(10); 
console.log(res); 

ES6 Number.parseFloat()

console.log(Number.parseFloat("10")); 
console.log(Number.parseFloat("10.23"));

15

import rand
X = rand.randint (1,54)
print (X)
if X>36 :
    print("leteral")
else :
    print ("coupe")

ES6 Number.isSafeInteger()

var res = Number.isSafeInteger(10); 
console.log(res);

ES6 Number.isInteger()

console.log(Number.isInteger(0));         // true 
console.log(Number.isInteger(1));         // true 
console.log(Number.isInteger(-100000));   // true 
console.log(Number.isInteger(0.1));       // false 
console.log(Number.isInteger(Infinity));   // false 
console.log(Number.isInteger("10"));      // false 
console.log(Number.isInteger(true));      // false 
console.log(Number.isInteger(false));     // false  

ES6 Number.isFinite()

var res = Number.isFinite(10); 
console.log(res); 

ES6 Number.isNaN()

var res = Number.isNaN(10); 
console.log(res); 

sumscount

var
    i,j,k: integer;
    count: integer = 1;
const
    limit: integer = 99;
    target: integer = 100;
 
begin
    for i:=1 to limit do 
        for j:=1 to limit do
            for k:=1 to limit do
                if i + j + k = target then inc(count);
    writeln(count);
end.

Compile and Execute Java Online

public class FibonacciExample1  
public static void main(String args[])  
{    
 int n1=0,n2=1,n3,i,count=12;    
 System.out.print(n1+" "+n2);//printing 0 and 1    
    
 for(i=2;i<count;++i)//loop starts from 2 because 0 and 1 are already printed    
 {    
  n3=n1+n2;    
  System.out.print(" "+n3);    
  n1=n2;    
  n2=n3;    
 }    
  
} 

How to prevent Cloning to break a Singleton Class Pattern in java?

public class Tester{
   public static void main(String[] args) 
      throws CloneNotSupportedException { 
      A a = A.getInstance();
      A b = (A)a.clone();

      System.out.println(a.hashCode());
      System.out.println(b.hashCode());
   }
}

class A implements Cloneable {
   private static A a; 
   private A(){}

   public static A getInstance(){
      if(a == null){
         a = new A(); 
      }
      return a;
   } 

   @Override
   protected Object clone() 
      throws CloneNotSupportedException {
      return super.clone();
   }
}

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.