Java Character Wrapper Class

public class CharacterClassExample {public static void main(String[] args) {char ch1, ch2;ch1='9';ch2='V';boolean b1, b2;b1=Character.isDigit(ch1);b2=Character.isDigit(ch2);String str1=ch1 + " is a digit is " + b1;String str2=ch2 + " is a digit is " + b2;System.out.println( str1 );System.out.println( str2 );}}

Java Number Wrapper Class

public class NumberClassExample {public static void main(String args[]){Number num=new Integer("25");System.out.println("Float value of the number: "+num.floatValue());System.out.println("Double value of the number: "+num.doubleValue());System.out.println("Long value of the number: "+num.longValue());System.out.println("Byte value of the number: "+num.byteValue());System.out.println("Double value of the number: "+num.doubleValue());System.out.println("Short value of the number: "+num.shortValue());}}

Java super class of every class in Java

public class Test {public static void main(String args[]){Test obj=new Test();Class cls=obj.getClass().getSuperclass();System.out.println(cls.getName());}}

Java differences between Java classes and Java objects

public class Puppy {public Puppy(String name) {// This constructor has one parameter, name.System.out.println("Passed Name is :" + name );}public static void main(String []args) {// Following statement would create an object myPuppyPuppy myPuppy=new Puppy( "tommy" );}}

Java declare, define and call a method

public class ExampleMinNumber {public static void main(String[] args) {int a=11;int b=6;int c=minFunction(a, b);System.out.println("Minimum Value=" + c);}/** Returns the minimum of two numbers */public static int minFunction(int n1, int n2) {int min;if (n1 > n2){min=n2;} else {min=n1;}return min;}}

sort list of dictionaries by values in Python

# Initializing list of dictionaries my_list1=[{ "name" : "Adwaita", "roll" : 100},{ "name" : "Aadrika", "roll" : 234 },{ "name" : "Sakya" , "roll" : 23 }]print ("The list is sorted by roll: ")print (sorted(my_list1, key=lambda i: i['roll']) )print ("\r")print ("The list is sorted by name and roll: ")print (sorted(my_list1, key=lambda i: (i['roll'], i['name'])) )print ("\r")print ("The list is sorted by roll in descending order: ")print (sorted(my_list1, key=lambda i: i['roll'],reverse=True) )

Matrix manipulation in Python

import numpy# Two matrices are initialized by valuex=numpy.array([[1, 2], [4, 5]])y=numpy.array([[7, 8], [9, 10]])# add()is used to add matricesprint ("Addition of two matrices: ")print (numpy.add(x,y))# subtract()is used to subtract matricesprint ("Subtraction of two matrices : ")print (numpy.subtract(x,y))# divide()is used to divide matricesprint ("Matrix Division : ")print (numpy.divide(x,y))print ("Multiplication of two matrices: ")print (numpy.multiply(x,y))print ("The product of two matrices : ")print (numpy.dot(x,y))print ("square root is : ")print (numpy.sqrt(x))print ("The summation of elements : ")print (numpy.sum(y))print ("The column wise summation : ")print (numpy.sum(y,axis=0))print ("The row wise summation: ")print (numpy.sum(y,axis=1))# using "T" to transpose the matrixprint ("Matrix transposition : ")print (x.T)

Java getCanonicalName()

import java.lang.*;public class ClassDemo {public static void main(String[] args) {ClassDemo c=new ClassDemo();Class cls=c.getClass();//Returns the canonical name of the underlying class if it existsSystem.out.println("Class=" + cls.getCanonicalName());}}

Java Find the Version

public class Test {public static void main(String args[]){Test obj=new Test(); String os=System.getProperty("java.version");System.out.println("Current Java version is: "+os); }}

Java How to determine the OS

public class Sample {public static void main(String args[]){String os=System.getProperty("os.name");System.out.println("Current Os is: "+os); } }

1 2 3 4 5 6 7 ... 1884 Next
codeproject.com, mangafox.me, askubuntu.com, ascii.jp, viralnova.com, theblaze.com, telegraaf.nl, tabnak.ir, prothom-alo.com, smh.com.au,