Java – class inheritance | superclass and subclass

Java – class inheritance | superclass and subclass

In Java a class can inherit another class. The inherited class is called Superclass and the class that inherits another class it is called subclass. syntax: puplic class subclassName extends superclassName{ additional fields and methods or method overriding } The subclass should only declare new fields, implement new methods or override superclass methods. All the variables and methods of the superclass are inherited automatically. As you see on the example above, the subclass’s constructor called the superclass constructor using the super keyword. This is important. The subclass must initialize the…

Java – class inheritance | superclass and subclass Read More

Java – Random class

Java – Random class

Random class generates pseudo-random numbers, not really random numbers but they appear to be. use: import java.util.Random;…Random rand = new Random();int randomNumber = rand.nextInt(); common methods: nextInt() – Returns the next pseudorandom, uniformly distributed int value from this random number generator’s sequence. nextInt(max) – Returns a pseudorandom, uniformly distributed int value between 0 (inclusive) and the specified value (exclusive), drawn from this random number generator’s sequence. nextDouble() – Returns the next pseudorandom, uniformly distributed double value between 0.0 and 1.0 from this random number generator’s sequence. Read more here. Random Number Within a Given Range Random letter Random rand =…

Java – Random class Read More

Java – String and Character class

Java – String and Character class

String class represents character string. For example: String name = “Kronos”; Some String methods: String.concat(string) – Concatenates the specified string to the end of this string. String.subString(begin,end) – Returns a string that is a substring of this string. The substring begins at the specified begin and extends to the character at index end – 1 String.startsWith(string) – Tests if this string starts with the specified prefix. String.length() – Returns the length of this string. String.indexOf(char) – Returns the index within this string of the first occurrence of the specified character. String.toLowerCase() – Converts…

Java – String and Character class Read More

Java – Math class

Java – Math class

The class Math contains methods for performing basic numeric operations such as the elementary exponential, logarithm, square root, and trigonometric functions. Some methods Math.sqlt(value) – Returns the correctly rounded positive square root of a double value. Math.abs(value) – Returns the absolute value of a value. Math.min(value1, value2) – Returns the smaller of two values. Math.max(value1, value2) – Returns the greater of two values. Math.round(value) – Returns the closest number to the argument. Math.ceil(value) – Returns the smallest value that is greater than or equal to the argument. Math.floor(value) – Returns the largest value that…

Java – Math class Read More

Windows Server 2016 – DHCP define User Class and Configure Class Options

Screenshot 20181228 085553

Open DHCP console, expand the server, right-click IPv4/IPv6 and click Defie User Classes Click Add. Specify the name and description. Now click with the mouse below ASCII and give a name, probably the same as before. Click OK. Click Close. You have to use DHCP policies to configure DHCP options to the user class you created. Right-click Policies and then click New Policy… Give a Name and Description and click Next. Click Add Choose User Class at Criteria, Equals at Operator and select the user class you created before from…

Windows Server 2016 – DHCP define User Class and Configure Class Options Read More