Found 33676 Articles for Programming

Primitive Wrapper Classes are Immutable in Java

Arjun Thakur
Updated on 25-Jun-2020 14:06:49

2K+ Views

In Java Immutable class is a class which once created and it's contents can not be changed.On same concept Immutable objects are the objects whose state can not be changed once constructed.Wrapper classes are made to be immutable due to following advantages −Since the state of the immutable objects can not be changed once they are created they are automatically synchronized.Immutable objects are automatically thread-safe, the overhead caused due to use of synchronisation is avoided.Once created the state of the wrapper class immutable object can not be changed so there is no possibility of them getting into an inconsistent state.The ... Read More

POJO vs Java Beans

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

5K+ 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 classes must have default constructor i.e no argument constructor.Public Getter and Setter must be present in both the classes in order to access the variables/properties.The only difference between both the classes is Java make java beans objects serialized so that the state of a bean class could be preserved in ... Read More

POJI in Java

Ankith Reddy
Updated on 25-Jun-2020 14:07:52

530 Views

POJI is an acronym for Plain Old Java Interface which corresponds to a Java standard interface which means that these interfaces are in the context of providing services in JEE. For example, OSGI service is offered through POJI in JEEIn other terms we can say that POJI is an ordinary interface without any specialty that is not inherited from any of the technology API specific interfaces or framework interfaces.Exampleinterface myCustomInterface {    public void myMethod(); } interface mySecondCustomInterface extends myCustomInterface {    public void mySecondMethod(); }Both interfaces would be called as POJI as they do not inherit any technology specific ... Read More

Passing and Returning Objects in Java

Chandu yadav
Updated on 25-Jun-2020 14:08:38

5K+ Views

As we know it is core concept that in Java there is always pass by value and not by pass by reference.So in this post we will focus on that how this concept get validated in case of passing primitive and passing reference to a method.In case when a primitive type is passed to a method as argument then the value assigned to this primitive is get passed to the method and that value becomes local to that method, which means that any change to that value by the method would not change the value of primitive that you have ... Read More

Constructor Chaining In Java programming

Aishwarya Naglot
Updated on 01-Sep-2025 13:19:16

2K+ Views

The constructor chaining is a specific sequence of calling constructors when a user initializes an object in a certain way. This technique is used when multiple constructors are invoked one after another, based on the instance class. It is also closely related to inheritance, where the role of a subclass constructor is to call the constructor of its superclass. You can perform constructor chaining in two ways: Within the same class - where one constructor calls another constructor of the same class. Across different classes - where a subclass constructor calls ... Read More

Python Interface to UNIX syslog library routines

George John
Updated on 30-Jul-2019 22:30:23

337 Views

To get the UNIX syslog library information, we need to use the syslog module into our programs. This module has syslog has different modules for the syslog library. To use this module, we should import it using − import syslog The methods are like below − Method syslog.syslog(message) or syslog.syslog(priority, message) This method is used to send a string type message to the system logger. Each message has a priority. The priority argument can be used to set the priority of the given message. Method syslog.openlog([ident[, logoption[, facility]]]) This method is used to logging options of subsequent syslog ... Read More

Resource Usage Information using Python

Chandu yadav
Updated on 30-Jul-2019 22:30:23

902 Views

To measure the UNIX resource usage, we need to use the resource module into our programs. This module also can control the resource utilization. To use this module, we should import it using − import resource Resource Limits In this module we can use the setrlimit() to limit the resource utilization. There are two parameters to limit the resources. These parameters are soft limit and the hard limit. The soft limit is basically the current limit, it can be changed over process, but it cannot exceed the hard limit. The hard limit can be reduced to any value ... Read More

Python Interface to Shell Pipelines

Ankith Reddy
Updated on 30-Jul-2019 22:30:23

346 Views

To use the UNIX command pipeline mechanism using python. In the command pipelining a sequence converts from one file to another file. This module uses /bin/sh command line. So we need os.system() and os.popen() methods. To use this module, we should import it using − import pipes The pipes holds Template class − class pipes.Template This class is basically an abstraction of a pipeline. It has different methods. These are as follows. Method Template.reset() This method is used to restore the pipeline template to its initial position. Method Template.clone() This method is used to create another new, ... Read More

The fcntl and ioctl System Calls in Python

Arjun Thakur
Updated on 30-Jul-2019 22:30:23

3K+ Views

To control the files and the io, we should use the fcntl module. It is basically one interface to the fcntl() and ioctl() Unix routines. All methods in this module takes one integer or io.IOBase file-descriptor as their first argument. To use this module, we should import it using. import fcntl There are some modules of the fcntl module, these are − Method fcntl.fcntl(fd, op[, arg]) This method is used to perform the operation on the file using file descriptor. The operation is defined by op. The third argument is optional. It can be either integer type value ... Read More

POSIX Style TTY control using Python

Ankith Reddy
Updated on 30-Jul-2019 22:30:23

540 Views

The termios module provides an interface to the POSIX for tty I/O control. It is only available for Unix system. To use the termios module, we should import it using − import termios All methods in this module, takes the file descriptor as an argument. There are some modules of the termios module, these are − Method termios.tcgetattr(fd) This method returns a list of tty attributes for the given file descriptor. The attributes are iflag, oflag, cflag, lflag, ispeed, ospeed, cc. Method termios.tcsetattr(fd, when, attributes) This method is used to set the attribute from the list of attributes. ... Read More

Advertisements