Arjun Thakur has Published 1109 Articles

Method overloading with autoboxing and widening in Java.

Arjun Thakur

Arjun Thakur

Updated on 25-Feb-2020 06:08:01

181 Views

Widening refers to passing a lower size data type like int to a higher size data type like long. Method overloading is possible in such case. ExampleLive Demopublic class Tester {    public static void main(String args[]) {       Tester tester = new Tester();       short c ... Read More

how can I declare an Object Array in Java?

Arjun Thakur

Arjun Thakur

Updated on 24-Feb-2020 10:41:06

226 Views

Array of Object class can be created which can accept any type of object. During operation on such array, instanceof operator can be used.Examplepublic class Tester {    public static void main(String[] args) {       Object[] dataArray = new Object[3];       dataArray[0] = new Integer(0);   ... Read More

C++ Program to Sort an Array of 10 Elements Using Heap Sort Algorithm

Arjun Thakur

Arjun Thakur

Updated on 12-Feb-2020 07:17:15

2K+ Views

Heap Sort is based on the binary heap data structure. In the binary heap the child nodes of a parent node are smaller than or equal to it in the case of a max heap, and the child nodes of a parent node are greater than or equal to it ... Read More

Read a character from standard input without waiting for a newline in C++

Arjun Thakur

Arjun Thakur

Updated on 12-Feb-2020 06:26:23

3K+ Views

A portable solution doesn't exist for doing this. On windows, you can use the getch() function from the conio(Console I/O) library to get characters pressed.example#include #include using namespace std; int main() {     char c;     while(1){ // infinite loop         c = getch();         cout

The most elegant way to iterate the words of a C/C++ string

Arjun Thakur

Arjun Thakur

Updated on 11-Feb-2020 10:27:10

1K+ Views

There is no one elegant way to iterate the words of a C/C++ string. The most readable way could be termed as the most elegant for some while the most performant for others. I've listed 2 methods that you can use to achieve this. First way is using a stringstream ... Read More

What are the rules about using an underscore in a C++ identifier?

Arjun Thakur

Arjun Thakur

Updated on 11-Feb-2020 10:22:52

2K+ Views

From MSDN docs −Use of two sequential underscore characters ( __ ) at the beginning of an identifier, or a single leading underscore followed by a capital letter, is reserved for C++ implementations in all scopes. You should avoid using one leading underscore followed by a lowercase letter for names ... Read More

What are the basic rules for defining variables in C++?

Arjun Thakur

Arjun Thakur

Updated on 11-Feb-2020 08:04:48

836 Views

To declare a variable, you need to know what data type it is going to be of and what its name would be. The variable name has constraints on what you can name it. Following are the rules for naming variables −Variable names in C++ can range from 1 to ... Read More

In which conditions, MySQL CASE statement return NULL?

Arjun Thakur

Arjun Thakur

Updated on 11-Feb-2020 06:41:17

988 Views

As we know that if no comparison or condition is true then CASE statement returns the result specified after ELSE statement. But what if there is no ELSE statement, then in this situation, CASE statement would return NULL. Following is an example to demonstrate it.Examplemysql> Select CASE 100     -> WHEN 150 ... Read More

What is the best IDE of C++ on Linux?

Arjun Thakur

Arjun Thakur

Updated on 10-Feb-2020 12:45:34

458 Views

Big projects are difficult to manage on mere text editors. You're likely to be more productive and less frustrated if you use an IDE in such cases. There are various types of IDE's and you should select the right one which fits your needs. There is no single best IDE ... Read More

Eclipse Setup for C++ Development

Arjun Thakur

Arjun Thakur

Updated on 10-Feb-2020 12:18:06

174 Views

Step 0 − Install MinGW GCC or Cygwin GCCTo use Eclipse for C/C++ programming, you need a C/C++ compiler. On Windows, you could install either MinGW GCC or Cygwin GCC. Choose MinGW if you are not sure, because MinGW is lighter and easier to install, but has fewer features.MinGW GCC ... Read More

Advertisements