Programming Articles

Page 2538 of 2547

Regex named groups in Java

George John
George John
Updated on 30-Jul-2019 343 Views

Java Regex Capturing Groups

Read More

Regular Expressions syntax in Java Regex

Jai Janardhan
Jai Janardhan
Updated on 30-Jul-2019 325 Views

Following is a simple program demonstrating how to use regular expression in Java. Java Regex Characters

Read More

Why the use of "using namespace std' considered bad practice?

Abhinaya
Abhinaya
Updated on 30-Jul-2019 518 Views

C++ has a standard library that contains common functionality you use in building your applications like containers, algorithms, etc. If names used by these were out in the open, for example, if they defined a queue class globally, you'd never be able to use the same name again without conflicts. So they created a namespace, std to contain this change.The using namespace statement just means that in the scope it is present, make all the things under the std namespace available without having to prefix std:: before each of them.While this practice is okay for example code, pulling in the ...

Read More

What is object slicing in C++ or Java?

Ankitha Reddy
Ankitha Reddy
Updated on 30-Jul-2019 3K+ Views

Object slicing is used to describe the situation when you assign an object of a derived class to an instance of a base class. This causes a loss of methods and member variables for the derived class object. This is termed as information being sliced away. For example, class Foo { int a; }; class Bar : public Foo { int b; }; Since Bar extends Foo, it now has 2 member variables, a and b. So if you create a variable bar of type Bar and then create ...

Read More

Difference between undefined, unspecified, and implementation-defined behavior in C and C++?

Abhinanda Shri
Abhinanda Shri
Updated on 30-Jul-2019 631 Views

Undefined behavior is simply behavior that is not defined by the C++ specification. For example, if you have multiple unary increment/decrement operations in an expression like i++ + ++i, they result in behavior that is not defined. This is simply due to the fact that some language constructs are syntactically valid but you can't predict the behavior when the code is run. Another example is the expression: u = (u++);Implementation-defined behavior is behavior unspecified by the specification and left for the implementor to decide and document how the choice is made. In this case, the choice that is made must ...

Read More

What does the bitwise left shift operator do in Java?

Monica Mona
Monica Mona
Updated on 30-Jul-2019 322 Views

The left operand value is moved left by the number of bits specified by the right operand.Example: A

Read More

What does the bitwise right shift operator do in Java?

Lakshmi Srinivas
Lakshmi Srinivas
Updated on 30-Jul-2019 430 Views

The left operand value is moved right by the number of bits specified by the right operand.Example: A >> 2 = 15 means 1111.

Read More

What is the difference between the != and <> operators in Python?

Malhar Lathkar
Malhar Lathkar
Updated on 30-Jul-2019 345 Views

In Python 2.x, both != and operators are available to check if two operands are not equal. Both return true if operands are not equal and false if they are equal.In Python 3.x, operator has been deprecated.

Read More

Difference between C++ string constants and character constants

karthikeya Boyini
karthikeya Boyini
Updated on 30-Jul-2019 952 Views

In C++, a character in single quotes is a character literal. It's of type char. For example, 'a' is of type char with a value 97 on an ASCII based system.A character or a string of characters together in double quotes represent a string literal. It's of type const char[] and refers to an array of size length of string + 1. That extra character is there for marking the string's ending.String literals can be arbitrarily long, such as "abcdefg". Character literals almost always contain just a single character. When these are being printed, string literals are printed till the ...

Read More

What is the type of string literals in C and C++?

Lakshmi Srinivas
Lakshmi Srinivas
Updated on 30-Jul-2019 890 Views

In C the type of a string literal is a char[]. In C++, an ordinary string literal has type 'array of n const char'. For example, The type of the string literal "Hello" is "array of 6 const char". It can, however, be converted to a const char* by array-to-pointer conversion.Note that Array-to-pointer conversion results in a pointer to the first element of the array.

Read More
Showing 25371–25380 of 25,467 articles
Advertisements