Advert

Java vs. C++

Last edited by . Total of 1 comment in the discussion.

C++ supports pointers; Java does not (Java does have object references) C++ supports mutiple inheritance directly; Java supports multiple inheritance only through interfaces C++ supports operator overloading; Java does not C++ supports global variables; Java does not (sort of) C++ supports #define; Java does not C++ supports typedef; Java does not C++ supports enum; Java does not C++ supports unions; Java does not C++ supports structs; Java does not C++ supports constants; Java supports final variables

Share on:

Queues

Last edited by . Total of no comments in the discussion.

A queue is a line of persons waiting for their turn at some service counter. The service counter can be a ticketing window of a cinema hall, a railway station, etc. Depending on the type of service provided by the service counter and number of persons interested in service, there could be queues of varying lengths. The service at the service counter is on the first come first serve (FCFS) basis, i.e., in order of their arrival in the queue. Suppose that at a service counter, t1 units of time Read More

Share on:

Exception Handling

Last edited by . Total of no comments in the discussion.

Exceptions are of two kinds, namely, synchronous exceptions and asynchronous exceptions. Errors such as "out-of-range index" and "over-flow" belong to the synchronous type exceptions. The errors that are caused by events beyond the control of the program (such as keyboard interrupts) are called asynchronous exceptions. The proposed exception handling mechanism in C++ is designed to handle only synchronous exceptions. The purpose of the exception handling mechanism is to provide means to detect and report an exceptional circumstance or condition, so that appropriate action can be taken against it. The mechanism Read More

Share on:

Java Operators

Last edited by . Total of no comments in the discussion.

Java Operator Operator Description [ ] Array index () Method call . Member access ++ Prefix or postfix increment — Prefix or postfix decrement + – Unary plus, minus ~ Bitwise NOT ! Boolean (logical) NOT (type) Type cast new Object creation * / % Multiplication, division, remainder + – Addition, subtraction + String concatenation << Signed bit shift left to right >> Signed bit shift right to left >>> Unsigned bit shift right to left < <= Less than, less than or equal to > >= Greater than, greater Read More

Share on:

Structures

Last edited by . Total of no comments in the discussion.

Structure is a collection of variables referenced under a common name. Sometimes, some logically related elements need to be treated under one single unit. For instance, the elements that store student information (e.g., rollnumber, name, class, marks and grade) need to be processed together under one roof. Defining a structure: struct tag-name { Member1 ; Member2 ; Member3 ; } ; struct is a required keyword to define a structure. tag-name is the name that identifies the structure. member1, member2 and member3 are the members of the structure. Complex data Read More

Share on:

Classes

Last edited by . Total of no comments in the discussion.

A class is an approach to bind the data, describing the entity or an object, and its associated functions together. In C++, a class creates a data-type that is used to create objects of that particular type. Class represents a group of similar objects. Example: class account { private: int accoutno; char type; float balance; public: float deposite(float amount) { balance += amount; return balance; } float withdraw(float amount) { balance -= amount; return balance; } }; In the above example, the data describing an account object (i.e. accountno, type Read More

Share on:

Uninstall Java

Last edited by . Total of no comments in the discussion.

Java is created to operate in the distributed environment on the net. It is much easier to use compared to C++. Java functions are based on the object-oriented programming model. You can use it for online video, audio, games, banking applications and chat. It is also used in various intranet applications. Microsoft Java was first developed for Internet Explorer 3. This was the fastest implementation of JVM (Java Virtual Machine) for the first couple of years after Java release. The creator of Java, Sun Microsystems, sued Microsoft for incomplete implementation of Read More

Share on:

Race Condition

Last edited by . Total of 3 comments in the discussion.

A race condition occurs when multiple processes access and manipulate the same data concurrently, and the outcome of the execution depends on the particular order in which the access takes place. A race condition is of interest to a hacker when the race condition can be utilized to gain privileged system access. Consider the following code snippet which illustrates a race condition: if(access("/tmp/datafile",R_OK)==0){ fd=open("/tmp/datafile process(fd); close(fd); This code creates the temporary file /tmp/datafile and then opens it. The potential race condition occurs between the call to access() and the call Read More

Share on:

Iterations

Last edited by . Total of no comments in the discussion.

An Iteration involves repeating some portion of a program, a specified number of time or until a particular condition is satisfied. This repetitive operation in C and C++ is achieved through for, while and do–while loop. How does a for loop work? A for loop is the easiest iteration loop to understand the C and C++ loops. All the loop elements are gathered at one place unlike the other loops, where, the loop elements are scattered all over the loop body. Syntax: for( initialization ; condition ; increment or decrement Read More

Share on:

Functions

Last edited by . Total of no comments in the discussion.

A function is a named unit of a group of program statements. This unit can be invoked from other parts of the program. A programmer can solve a simple problem in C++ with a single function. Difficult and complex problems can be decomposed into sub-problems, each of which can be either coded directly or further decomposed. Decomposing difficult problems, until they are directly code-able as single C++ functions, is a software engineering method of stepwise refinement. These functions are combined into other functions and are ultimately used in main() to Read More

Share on: