George John has Published 1167 Articles

POJO vs Java Beans

George John

George John

Updated on 25-Jun-2020 14:07:32

4K+ Views

As we know that in Java POJO refers to the Plain old Java object.POJO and Bean class in Java shares some common features which are as follows −Both classes must be public i.e accessible to all.Properties or variables defined in both classes must be private i.e. can't be accessed directly.Both ... Read More

Get the list of all the public methods in Java

George John

George John

Updated on 25-Jun-2020 14:05:34

5K+ Views

A list of all the public methods of a class or interface that is represented by an object are provided using the method java.lang.Class.getMethods(). The public methods include that are declared by the class or interface and also those that are inherited by the class or interface.Also, the getMethods() method ... Read More

Access to the Group Database in Python

George John

George John

Updated on 25-Jun-2020 14:03:37

205 Views

To access the UNIX group database, we should use the grp module. The shadow password database entries are like tuple like object.To use the grp module, we should import it using −import grpThe attributes of the grp database are −IndexAttribute & Description0gr_nameThe Name of the groups1gr_passwdThe Encrypted password for the ... Read More

What would getPackage() return for a class in unnamed package in Java?

George John

George John

Updated on 25-Jun-2020 14:02:36

207 Views

The package for a class can be obtained using the java.lang.Class.getPackage() method with the help of the class loader of the class.The getPackage() method returns null for a class in unnamed package. A program that demonstrates this is given as follows −Example Live Democlass Class1 {    public class Main { ... Read More

Compression compatible with gzip in Python (zlib)

George John

George John

Updated on 25-Jun-2020 14:02:35

695 Views

The zlib module provides Python’s implementation of Zlib compression library (http://www.zlib.net) which is a part of GNU project.This article discusses important functions defined in zlib module.compress()This function is the primary interface to this module along with decompress() function. This function returns byte object by compressing the data given to it ... Read More

Get super class of an object in Java

George John

George John

Updated on 25-Jun-2020 13:52:19

541 Views

The immediate superclass of any entity such as an object, class, primitive type, interface etc. can be obtained using the method java.lang.Class.getSuperclass(). This method contains no parameters.A program that demonstrates this is given as follows −Example Live Demopublic class Main {    public static void main(String[] args) {       ... Read More

MySQL sort string number?

George John

George John

Updated on 25-Jun-2020 13:50:11

905 Views

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 -> ( ... Read More

Python object persistence (shelve)

George John

George John

Updated on 25-Jun-2020 13:48:57

4K+ Views

The shelve module in Python’s standard library is a simple yet effective tool for persistent data storage when using a relational database solution is not required. The shelf object defined in this module is dictionary-like object which is persistently stored in a disk file. This creates afile similar to dbm ... Read More

Get the fully-qualified name of a class in Java

George John

George John

Updated on 25-Jun-2020 13:48:16

9K+ Views

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) ... Read More

CSS nav-down property

George John

George John

Updated on 25-Jun-2020 13:39:32

119 Views

The nav-down property is used to move down when you have pressed on down arrow button in keypad. You can try to run the following code to implement the CSS nav-down propertyExampleLive Demo                    button {         ... Read More

Advertisements