Override a Protected Method in Java

raja
Updated on 01-Dec-2023 11:07:06

7K+ Views

Yes, the protected method of a superclass can be overridden by a subclass. If the superclass method is protected, the subclass overridden method can have protected or public (but not default or private) which means the subclass overridden method can not have a weaker access specifier. Example class A { protected void protectedMethod() { System.out.println("superclass protected method"); } } class B extends A { protected void protectedMethod() { System.out.println("subclass protected method"); } } public class Test { public static void main(String args[]) { B b = new B(); b.protectedMethod(); } } Output subclass protected method

Importance of Locale Class in Java

raja
Updated on 01-Dec-2023 10:43:28

278 Views

A Locale class is used to perform locale operations and supply locale information to the user. A Locale is defined as a set of parameters that represents a geographical location or place where some operation occurs. The important methods of Locale class are getAvailableLocales(), getCountry(), getDefault(), getDisplayLanguage(), getDisplayCountry(), getUnicodeLocaleKeys() etc. The Locale class uses the following constructors − Locale(String L)− Initializes locale from the language code passed as an argument. Locale(String L, String C) − Initializes locale from the language, country code passed as arguments. Locale(String L, String C, String V) − Initializes locale from the language, country, variant passed as arguments. Example import java.text.SimpleDateFormat; import java.util.Locale; public ... Read More

Serialize and Deserialize an Object in Java

raja
Updated on 01-Dec-2023 10:38:28

2K+ Views

The Serialization is a process of changing the state of an object into a byte stream, an object is said to be serializable if its class or parent classes implement either the Serializable or Externalizable interface and the Deserialization is a process of converting the serialized object back into a copy of an object. During serialization, if we don’t want to write the state of a particular variable in a byte stream using a transient keyword. When the JVM comes up to the transient keyword, it ignores the original state of a variable and stores a default value of that data type ... Read More

Implement Custom HashSet in Java

raja
Updated on 01-Dec-2023 10:02:50

3K+ Views

A HashSet implements Set interface which does not allow duplicate values. A HashSet is not synchronized and is not thread-safe. When we can add any duplicate element to a HashSet, the add() method returns false and does not allow to add a duplicate element to HashSet. Syntax public class HashSet extends AbstractSet implements Set, Cloneable, Serializable In the below example, we can implement a Custom HashSet. Example import java.util.*; public class CustomHashSetTest extends AbstractSet { private HashMap map = null; private static final Object tempObject = new Object(); public CustomHashSetTest() { map = new HashMap(); ... Read More

Stop a Thread in Java

raja
Updated on 01-Dec-2023 09:32:48

25K+ Views

Whenever we want to stop a thread from running state by calling stop() method of Thread class in Java. This method stops the execution of a running thread and removes it from the waiting threads pool and garbage collected. A thread will also move to the dead state automatically when it reaches the end of its method. The stop() method is deprecated in Java due to thread-safety issues. Syntax @Deprecated public final void stop() Example import static java.lang.Thread.currentThread; public class ThreadStopTest { public static void main(String args[]) throws InterruptedException { UserThread userThread = new UserThread(); ... Read More

Full Form of CDR

Praveen Varghese Thomas
Updated on 29-Nov-2023 18:34:14

250 Views

Introduction Corporate Debt Restructuring (CDR) is a process where a company arranges with its banks to rebuild the terms of its exceptional debt to improve its financial circumstances. CDR is typically done when a company is encountering financial trouble and is incapable of meeting its debt commitments. The rebuilding can include measures such as amplifying the repayment period, reducing the intrigued rate, or converting obligation into equity. The objective of CDR is to provide relief to the company from its obligation burden, improve its cash flow and productivity, and ultimately, ensure its long-term reasonability. CDR is a complex process ... Read More

Full Form of CDSL

Praveen Varghese Thomas
Updated on 29-Nov-2023 18:30:43

160 Views

Introduction Central Depository Services Limited (CDSL) is a depository benefit supplier based in India. It is capable for the electronic bookkeeping, clearing, and settlement of securities such as equities, bonds, and other financial instruments traded on Indian exchanges. CDSL was joined in 1997 and has since ended up one of the two major storehouses in India, with over 20 million dynamic speculator accounts. The company works under the oversight of the Securities and Exchange Board of India (SEBI) and offers a range of administrations to its clients, including dematerialization of securities, account support, corporate activities processing, and other value-added ... Read More

Full Form of CEA

Praveen Varghese Thomas
Updated on 29-Nov-2023 18:24:46

249 Views

Introduction Consumer Electronics Association (CEA) is a well-known trade organisation in the United States that promotes the consumer electronics industry. The CEA provides lobbying, market research, and specialised training to its members, who include manufacturers, retailers, and service providers. The organisation also hosts notable annual events, such as the International CES, which functions as a platform for displaying cutting-edge technology and development. The CEA has played an important role in driving the growth of the customer electronics market and developing industry regulations. Its initiatives and contributions have had a significant effect on the industry and the economy as a ... Read More

Full Form of CECA

Praveen Varghese Thomas
Updated on 29-Nov-2023 18:21:17

368 Views

Introduction Comprehensive Economic Cooperation Agreement (CECA) is a multilateral trade deal aimed at promoting financial cooperation and increasing exchange and investment flows. The settlement addresses a huge style of problems, along with item change, services, and investment, in addition to intellectual assets, competition, and authorities’ procurement. Because CECA is a comprehensive agreement, it covers many facets of economic cooperation besides just the exchange of goods. Its goal is to level the playing field for businesses in each nation, reduce alternative constraints, and increase economic integration. CECA has the potential to benefit both countries by encouraging economic growth, job creation, ... Read More

Full Form of CEPA

Praveen Varghese Thomas
Updated on 29-Nov-2023 18:16:33

510 Views

Introduction Comprehensive Economic Partnership Agreement (CEPA) is a free trade settlement among two or extra countries along with their goals to encourage economic cooperation and integration. The settlement covers a broad range of topics, including investments, products, services, intellectual property, and competition regulation. The CEPA goals to cast off exchange and investment restrictions and level the playing area for government corporations. The goal of the agreement is to enhance international trade and marketplace access, consequently increasing business possibilities and stimulating economic growth. Objectives Promoting economic cooperation and integration between member nations is one of the primary goals of comprehensive ... Read More

Advertisements