How to split a string in Java?

Vikyath Ram
Published on 03-Jan-2018 17:24:46
Java provides a split() methodology you'll be able to split the string around matches of the given regular expression.The array returned by this method contains each substring of this string that is terminated by another substring that matches the given expression or is terminated by the end of the string. If ... Read More

How do i match just spaces and newlines with Python regex?

Rajendra Dharmkar
Published on 10-Jan-2018 12:17:19
The following matches and prints just spaces and newlines in the given string using Python regeximport re foo = ' I find   Tutorialspoint   useful' result = re.findall(r'\s+', foo) print resultThis gives the output[' ', ' ', ' \n ', ' \n ']

What does the modifier volatile in Java do?

Jai Janardhan
Published on 03-Jan-2018 17:15:39
The volatile modifier is used to let the JVM understand that a thread accessing the variable should always merge its own personal copy of the variable with the original in the memory.Accessing a volatile variable synchronizes all the cached copy of the variables in the main memory. Volatile can only ... Read More

What does the modifier transient in Java do?

George John
Published on 03-Jan-2018 17:12:01
An instance variable is marked transient to point the JVM to skip the actual variable once serializing the thing containing it. This modifier is included in the statement that creates the variable, preceding the class or data type of the variable. Example public class Employee implements java.io.Serializable { ... Read More

Can access modifiers be used for local variables in Java?

Arushi
Published on 03-Jan-2018 17:08:53
Yes, a local variable can be public, private, protected or default.

What is recursion & backtracking in Python?

Rajendra Dharmkar
Published on 10-Jan-2018 11:49:31
Recursion Recursion is useful in dividing and solving problems. Each recursive call itself spins off other recursive calls. At the centre of a recursive function are two types of cases: base cases, which tell the recursion when to terminate, and recursive cases that call the function they are in. A simple ... Read More

How to use the final modifier in Java?

Moumita
Published on 03-Jan-2018 17:06:50
The final modifier can be associated with methods, classes and variables. Once declared final − A final class cannot be instantiated. A final method cannot be overridden. A final variable cannot be reassigned. Example Live Demo class TestExample { final int value = ... Read More

What does abstract modifier in Java do?

Vikyath Ram
Published on 03-Jan-2018 17:03:11
An abstract keyword is used to declare methods abstract methods and abstract classes. Once a method is declared abstract we should not specify body for those. Example public abstract class Sample{ public abstract demo(){ } } Error Sample.java:2: error: invalid method ... Read More

What are final, abstract, synchronized non-access modifiers in Java?

Jai Janardhan
Published on 03-Jan-2018 15:42:43
The abstract keyword is used to declare methods abstract methods and abstract classes. Once a method is declared abstract we should not specify body for those. And once a class is declared abstract it cannot be instantiated. Example Live Demo abstract class Employee { private ... Read More

What is the scope of private access modifier in Java?

George John
Published on 03-Jan-2018 15:38:35
The scope of the private modifier lies with in the class. Members that are declared private cannot be accessed outside the class. Private access modifier is the most restrictive access level. Class and interfaces cannot be private. Variables that are declared private can be accessed outside the class, if public ... Read More
Advertisements