The modifiers for a class or an interface are returned by the java.lang.Class.getModifiers() method. These modifiers are encoded as an integer and they consist of the JVM’s constants for public, private, protected, final, abstract, static and interface.A program that demonstrates this is given as follows −Example Live Demoimport java.lang.reflect.Modifier; public class Main { public static void main(String[] argv) throws Exception { int modifiers = String.class.getModifiers(); String modifierString = Modifier.toString(modifiers); System.out.println("The Modifier is: " + modifierString); } }OutputThe Modifier is: public finalNow let us understand the above program.The method getModifiers() is ... Read More
To sort string number, use the CAST() function from MySQL. The syntax is as follows −SELECT *FROM yourTableName ORDER BY (yourColumnName as Decimal(integerValue, integerValueAfterDecimalPoint)) desc;To understand the above syntax, let us first create a table. The query to create a table is as follows −mysql> create table SortingStringDemo -> ( -> Amount varchar(10) -> ); Query OK, 0 rows affected (0.91 sec)Insert some records in the table using insert command. The query is as follows.mysql> insert into SortingStringDemo values('12.34'); Query OK, 1 row affected (0.21 sec) mysql> insert into SortingStringDemo values('124.50'); Query OK, 1 row affected (0.56 sec) ... Read More
The getName() method is used to get the names of the entities such as interface, class, array class, void etc. that are represented by the class objects. These names are returned in the form of a string.A program that gets the name of the member objects using getName() method is given as follows −Example Live Demoimport java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.Method; public class Main { public static void main(String[] argv) throws Exception { Class c = java.lang.Integer.class; Method m = c.getMethods()[0]; Field f = c.getFields()[0]; Constructor cons = ... Read More
A qualified class name in Java contains the package that the class originated from. In contrast to this, the unqualified class name contains only the class name without any package information. A program that gets the unqualified name of a class is given as follows:Example Live Demopublic class Demo { public static void main(String[] argv) throws Exception { Class c = java.util.ArrayList.class; String className = c.getName(); System.out.println("The qualified class name is: " + className); if (className.lastIndexOf('.') < 0) { className = className.substring(className.lastIndexOf('.') + 1); ... Read More
Software testing has become very important in our society because the world has grown very fast and we are not able to keep up with the world. The internet customers want their products to get implemented and developed and want to be updated faster than their competitors.The customers want their products to have the latest software for better performances and for better efficiency rate. The customers want their software releases with new features and to be implemented in a shorter period of time because of the competition from the competitors. The customers don't like to work with defected software.Software testing ... Read More
You can use DATE() from MySQL to select records with a particular date. The syntax is as follows.SELECT *from yourTableName WHERE DATE(yourDateColumnName)=’anyDate’;To understand the above syntax, let us first create a table. The query to create a table is as follows.mysql> create table AllRecordsFromadate -> ( -> Id int, -> Name varchar(100), -> Age int, -> AdmissionDate datetime -> ); Query OK, 0 rows affected (0.53 sec)Insert some records in the table using insert command. The query to insert records is as follows.mysql> insert into AllRecordsFromadate values(101, 'John', 23, '2018-10-13'); Query OK, 1 row affected (0.18 sec) mysql> insert ... Read More
In python, there is a standard library, called string. In the string module, there are different string related constants, methods, classes are available.To use these modules, we need to import the string module in our code.import stringSome string constants and their corresponding values are as follows −Sr.No.String Constant & Values into it1string.ascii_lowercase‘abcdefghijklmnopqrstuvwxyz’2string.ascii_uppercase‘ABCDEFGHIJKLMNOPQRSTUVWXYZ’3string.ascii_lettersConcatenation of asci_lowwecase and ascii_uppercase ‘abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ’4string.digits‘0123456789’5string.hexdigits‘0123456789abcdefABCDEF’6string.octdigits‘01234567’7string.punctuation‘!"#$%&\'()*+, -./:;?@[\]^_`{|}~’8string.printableAll printable ASCII characters. It is collection of asci_letters, punctuation, digits and whitespace.‘0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&\'()*+, -./:;?@[\]^_`{|}~ \t\r\x0b\x0c’9string.whitespace‘\t\r\x0b\x0c’Example Code Live Demoimport string print(string.hexdigits) print(string.ascii_uppercase) print(string.printable)Output0123456789abcdefABCDEF ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&'()*+, -./:;?@[\]^_`{|}~String FormattingThe built-in string class in python supports different complex variable substitution and value formatting by the format() method.To format ... Read More
A fully-qualified class name in Java contains the package that the class originated from. An example of this is java.util.ArrayList. The fully-qualified class name can be obtained using the getName() method.A program that demonstrates this is given as follows −Example Live Demopublic class Demo { public static void main(String[] argv) throws Exception { Class c = java.util.ArrayList.class; String className = c.getName(); System.out.println("The fully-qualified name of the class is: " + className); } }OutputThe fully-qualified name of the class is: java.util.ArrayListNow let us understand the above program.The getName() method is used ... Read More
A fully-qualified class name in Java contains the package that the class originated from. Also, an inner class is a class that is another class member. So, the fully-qualified name of an inner class can be obtained using the getName() method.A program that demonstrates this is given as follows −Example Live Demopublic class Main { public static void main(String[] argv) throws Exception { Class c = java.lang.Character.Subset.class; String innerClassName = c.getName(); System.out.println("The fully qualified name of the inner class is: " + innerClassName); } }OutputThe fully qualified name of the ... Read More
The pathlib module provides an object oriented approach to handling filesystem paths. The module also provides functionality appropriate for various operating systems. Classes defined in this module are of two types – pure path types and concrete path types. While pure paths can only perform purely computational operations, concrete paths are capable of doing I/O operations too.pathlib module defines following classes −Sr.No.Module & Description1PurePathThe base class for all other classes2Pathsubclassed from PurePath. This is a concrete class that represents filesystem path.3PosixPathPath subclass for non-Windows OS4WindowsPathPath subclass for Windows systems5PurePosixPathPurePath subclass for non-Windows systems6PureWindowsPathPurePath subclass for Windows systemsWhen instance of Path ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP