Object Oriented Programming Articles

Page 578 of 589

Which one is faster Array or List in Java

Moumita
Moumita
Updated on 30-Jul-2019 943 Views

The array is faster in case of access to an element while List is faster in case of adding/deleting an element from the collection.

Read More

Why can't static method be abstract in Java?

radhakrishna
radhakrishna
Updated on 30-Jul-2019 2K+ Views

A static method belongs to class not to object instance thus it cannot be overridden or implemented in a child class. So there is no use of making a static method as abstract.

Read More

Difference between declaring a variable before or in a Java loop.

Giri Raju
Giri Raju
Updated on 30-Jul-2019 175 Views

Performance wise, there is hardly any difference. But it is good to keep a variable local to the scope it is used. So declaring a variable inside Java loop is generally preferred.

Read More

How to concatenate byte array in java?

mkotla
mkotla
Updated on 30-Jul-2019 3K+ Views

You ByteArrayOutputStream to write byte arrays and get the result using its toByteArray() method.import java.io.ByteArrayOutputStream; import java.io.IOException; public class Tester { public static void main(String[] args) throws IOException { byte[] a = { 1,2,3}; byte[] b = { 4,5,6}; ByteArrayOutputStream baos = new ByteArrayOutputStream(); baos.write(a); baos.write(b); byte[] c = baos.toByteArray(); for(int i=0; i< c.length ; i++){ System.out.print(c[i] +" "); } } }Output1 2 3 4 5 6

Read More

Why java is both compiled and interpreted language.

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

Yes, a java program is first compiled into bytecode which JRE can understand. ByteCode is then interpreted by the JVM making it as interpreted language.

Read More

Regex named groups in Java

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

Java Regex Capturing Groups

Read More

Regular Expressions syntax in Java Regex

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

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

Read More

What is the package for String Class in Java?

Jai Janardhan
Jai Janardhan
Updated on 30-Jul-2019 5K+ Views

String class belongs to the java.lang package.

Read More

Is StringBuffer final in Java?

Anjana
Anjana
Updated on 30-Jul-2019 776 Views

Yes, StringBuffer class is final Java. We cannot override this class.

Read More

Why we do not import a package while we use any string function?

Sai Nath
Sai Nath
Updated on 30-Jul-2019 984 Views

The String class belongs to the java.lang package. This is the default package of the Java language therefore it is not mandatory to import it to use its classes.

Read More
Showing 5771–5780 of 5,881 articles
« Prev 1 576 577 578 579 580 589 Next »
Advertisements