Java Articles

Page 435 of 450

Fetch the value from an Octet Tuple in Java

Smita Kapse
Smita Kapse
Updated on 30-Jul-2019 181 Views

To fetch the value from an Octet Tuple, use the getValueX() method. Here X is the index for which you want the value.For example, to fetch the 5th element i.e. 4th index, use the getValueX() method as −getValue(4);Let us first see what we need to work with JavaTuples. To work with Octet class in JavaTuples, you need to import the following package −import org.javatuples.Octet;Note − Download JavaTuples Jar library to run JavaTuples program. If you are using Eclipse IDE, then Right Click Project -> Properties -> Java Build Path -> Add External Jars and upload the downloaded JavaTuples jar file. ...

Read More

Display all tables inside a MySQL database using Java?

Rishi Rathor
Rishi Rathor
Updated on 30-Jul-2019 2K+ Views

We will see here how to display all tables inside a MySQL database using Java. You can use show command from MySQL to get all tables inside a MySQL database.Let’s say our database is ‘test’. The Java code is as follows to show all table names inside a database ‘test’.The Java code is as follows. Here, connection is established between MySQL and Java −import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import com.mysql.jdbc.Connection; import com.mysql.jdbc.DatabaseMetaData; public class GetAllTables {    public static void main(String[] args) throws SQLException {       Connection conn = null;       try { ...

Read More

Use boolean value to stop a thread in Java

Vikyath Ram
Vikyath Ram
Updated on 30-Jul-2019 1K+ Views

A thread can be created by implementing the Runnable interface and overriding the run() method. Then a Thread object can be created and the start() method called.A thread can be stopped using a boolean value in Java. The thread runs while the boolean value stop is false and it stops running when the boolean value stop becomes true.A program that demonstrates this is given as follows:Exampleclass ThreadDemo extends Thread {    public boolean stop = false;    int i = 1;    public void run() {       while (!stop) {          try {     ...

Read More

Comparison of Java and .NET

Samual Sam
Samual Sam
Updated on 30-Jul-2019 418 Views

Java is a high-level programming language originally developed by Sun Microsystems and released in 1995. Java runs on a variety of platforms, such as Windows, Mac OS, and the various versions of UNIX. .NET framework is a computer software framework invented by Microsoft. It runs on Microsoft Windows OS (Operating Systems). It provides user interface, data access, database connectivity, cryptography, web application development, etc. Languages Java supports only Java patterns. .NET supports multiple languages such as VB.NET, C#, F#, etc. Platforms Java is platform independent and it can run on Windows, Linux and Mac OS. .NET works on Windows. Runtime ...

Read More

Where objects, methods and variables are stored in memory in Java?

Arjun Thakur
Arjun Thakur
Updated on 30-Jul-2019 4K+ Views

There are five main memory areas which are used to various Java elements. Following is the list of the same. Class Area - This area contains the static members of the class. Method Area - This area contains the method definition and executable code. Heap Area - This area contains the objects which are dynamically allocated/deallocated. if an object is no more referenced by any live reference it is deallocated. Stack Area - This area contains the local variables. Pool Area - Contains immutable objects like string.

Read More

Where objects, methods and variables are stored in memory in Java?

Arjun Thakur
Arjun Thakur
Updated on 30-Jul-2019 4K+ Views

There are five main memory areas which are used to various Java elements. Following is the list of the same. Class Area - This area contains the static members of the class. Method Area - This area contains the method definition and executable code. Heap Area - This area contains the objects which are dynamically allocated/deallocated. if an object is no more referenced by any live reference it is deallocated. Stack Area - This area contains the local variables. Pool Area - Contains immutable objects like string.

Read More

What are Java methods equivalent to C# virtual functions?

Sharon Christine
Sharon Christine
Updated on 30-Jul-2019 602 Views

All instance methods in Java are virtual except, static methods and private methods.

Read More

CamelCase in Java naming conventions

Ankitha Reddy
Ankitha Reddy
Updated on 30-Jul-2019 957 Views

Java follows camel casing for objects, class, variables etc. If a name is having multiple words, the first letter is small then consecutive words are joint with the first letter as a capital case. Consider the following example − Taxation Department Class - TaxationDepartment Object - taxationDepartment Method - getTaxationDepartmentDetails Variable - taxationDepartment

Read More

CamelCase in Java naming conventions

Ankitha Reddy
Ankitha Reddy
Updated on 30-Jul-2019 957 Views

Java follows camel casing for objects, class, variables etc. If a name is having multiple words, the first letter is small then consecutive words are joint with the first letter as a capital case. Consider the following example − Taxation Department Class - TaxationDepartment Object - taxationDepartment Method - getTaxationDepartmentDetails Variable - taxationDepartment

Read More

How to use R in Java-8 regex.

Arnab Chakraborty
Arnab Chakraborty
Updated on 30-Jul-2019 549 Views

\R matches any line break as defined by the Unicode standardPattern p = Pattern.compile("\R");Unicode line-break sequence is equivalent to \u000D\u000A|[\u000A\u000B\u000C\u000D\u0085\u2028\u2029]

Read More
Showing 4341–4350 of 4,495 articles
« Prev 1 433 434 435 436 437 450 Next »
Advertisements