What is Generics?

Generics is one type of facility of the generic programming and in 2004, it was added to the Java programming language in the java official release version J2SE 5.0

In 1998, Gilad Bracha, David Stoutamire, Martin Odersky and Philip Wadler created Generic Java as an extension to the Java language to support generic types. Generic Java was merged in Java with the addition of wildcards.

Find Factorial Value from Input Number

Source: var n; function calculatefactorial(n){ if(n==0){ return 1; }else{ return n*calculatefactorial(n-1); } } var number=prompt(“Enter a Numver: “,”1”); alert(calculatefactorial(number)); document.writeln(“Factorial of Your input (“+number+”) “+”is: “+calculatefactorial(number)); Download Complete Source Code

Check Prime Number From Start to End Number

Source: function isPrime(num){ var n=Math.sqrt(num); for(i=2;i<=n;i++){ if(num%i==0) return false; } return true; } function checkPrimeNumbers(startNum, endNum){ for(startNum; startNum<=endNum; startNum++){ if(isPrime(startNum)){ document.writeln(startNum+” “+”Is Prime”); document.writeln(“<br/>”); }else{ document.writeln(startNum+” ” +”Is not prime”); document.writeln(“<br/>”); } } } Download Complete Source Code

Check Prime Number

Source: function isPrime(num){ var n=Math.sqrt(num); for(i=2;i<=n;i++){ if(num%i==0) return false; } return true; } var number=prompt(“Enter for test”,”0″); if(number!=0 && number!=1){ if(isPrime(number)){ document.write(number+” “+”Is Prime”); }else{ document.write(number+” ” +”Is not prime”); } }else{ document.write(number+” ” +”Is not prime”); } Download Complete Source