Author Archives: Stanislav_Panteleev

Java.Core.What is autoboxing in Java and what are the rules for boxing primitive types in wrapper classes?

Autoboxing in Java Autoboxing is the automatic conversion of primitive data types into their corresponding wrapper classes when required. Example of Autoboxing: 👉 Here, primitiveInt (int) is automatically converted to Integer (wrapper class).

Posted in Без рубрики | Comments Off on Java.Core.What is autoboxing in Java and what are the rules for boxing primitive types in wrapper classes?

Java.Core.What are literals?

Literals in Java are fixed values assigned to variables or used directly in expressions. They represent constant values of different types, such as numbers, characters, booleans, and strings.

Posted in Без рубрики | Comments Off on Java.Core.What are literals?

Java.Core.When can a ClassCastException be thrown in an application?

1. Incorrect Downcasting Without Proper Type Checking

Posted in Без рубрики | Comments Off on Java.Core.When can a ClassCastException be thrown in an application?

Java.Core.Explain type casting. What is type downgrade and type promotion?

Type Casting in Java Type casting in Java refers to converting a variable of one data type into another. It is mainly classified into: Implicit Casting (Type Promotion) – Done automatically by Java when converting a smaller type to a … Continue reading →

Posted in Без рубрики | Comments Off on Java.Core.Explain type casting. What is type downgrade and type promotion?

Java.How are variables passed to methods, by value or by reference?

In Java, variables are always passed by value, but the behavior differs depending on whether the variable holds a primitive type or a reference type.

Posted in Без рубрики | Comments Off on Java.How are variables passed to methods, by value or by reference?

Java.Core.Is it true that primitive data types are always stored on the stack, and instances of reference data types are always stored on the heap?

No, it’s not entirely true that primitive data types are always stored on the stack and instances of objects are always stored on the heap. The actual memory allocation depends on where and how the variable is declared. Let’s break … Continue reading →

Posted in Без рубрики | Comments Off on Java.Core.Is it true that primitive data types are always stored on the stack, and instances of reference data types are always stored on the heap?

Java.Core.What is Heap and Stack memory in Java? What is the difference between them?

Heap and Stack Memory in Java Java memory is divided into two main areas: Heap Memory and Stack Memory. Each serves different purposes and has distinct characteristics.

Posted in Без рубрики | Comments Off on Java.Core.What is Heap and Stack memory in Java? What is the difference between them?

Java.Core.What is the difference between final, finally, and finalize()?

Difference Between final, finally, and finalize() in Java Even though final, finally, and finalize() sound similar, they serve completely different purposes in Java.

Posted in Без рубрики | Comments Off on Java.Core.What is the difference between final, finally, and finalize()?

Java.Core.What happens to the garbage collector if the finalize() method takes a noticeably long time to execute or an exception is thrown during execution?

If the finalize() method takes too long to execute or throws an exception, it can negatively impact the garbage collector (GC) performance and cause unexpected behavior. Let’s analyze both scenarios.

Posted in Без рубрики | Comments Off on Java.Core.What happens to the garbage collector if the finalize() method takes a noticeably long time to execute or an exception is thrown during execution?

Java.Core.What is finalize()? Why is it needed?

What is finalize() in Java? Why is it Needed? The finalize() method in Java is a special method that is called by the Garbage Collector (GC) before an object is removed from memory. It was designed to allow cleanup actions … Continue reading →

Posted in Без рубрики | Comments Off on Java.Core.What is finalize()? Why is it needed?