Found 4336 Articles for Java 8

How to make an Android device vibrate?

Ankith Reddy
Updated on 30-Jul-2019 22:30:25

862 Views

In android, using vibrate service, we can vibrate android mobile. This example demonstrate about how to make an Android device vibrateStep 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     In the above code, we have taken textview, when you click on textview. it will vibrate.Step 3 − Add the following code to src/MainActivity.javapackage com.example.andy.myapplication; import android.content.Context; import android.content.Intent; import android.os.Build; import android.os.Bundle; import android.os.VibrationEffect; import android.os.Vibrator; import android.support.v7.app.AppCompatActivity; import android.view.View; import ... Read More

How to Launch an application from another application on Android

Chandu yadav
Updated on 30-Jul-2019 22:30:25

6K+ Views

In android, we can lunch other applications using packing name. This example demonstrate about How to Launch an application from another application on Android.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     In the above code, we have created one textview. When you click on textview, it will open YouTube.Step 3 − Add the following code to src/MainActivity.javapackage com.example.andy.myapplication; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.LinearLayout; import android.widget.TextView; import ... Read More

How to Go back to previous activity in android

George John
Updated on 30-Jul-2019 22:30:25

4K+ Views

If you wants to go back from one activity to another activity, This example demonstrate about how to go back to previous activity in android.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     In the above code, we have given text view, when the user click on text view, it will open new activity.Step 3 − Add the following code to src/MainActivity.javapackage com.example.andy.myapplication; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import ... Read More

Exception Handling in C++ vs Java

Nancy Den
Updated on 30-Jul-2019 22:30:25

518 Views

There are key differences in Exception Handling in C++ vs JavaException handling in javaException handling in C++Only throwable objects can be thrown as objects.All types can be thrown as exceptionIn java, finally is a block that is executed after try catch block for cleaning up.In C++ there is no existence of finally blockA new keyword throws is used to list exceptions thrown by a function.Throw keyword is used to list exceptions thrown by a function.Both checked and unchecked exceptions are present.Only unchecked exceptions are present.

How to update the column of a row in a CachedRowSet object in JDBC?

Samual Sam
Updated on 30-Jul-2019 22:30:25

489 Views

The CachedRowSet is the base implementation of disconnected row sets. It connects to the data source, reads data from it, disconnects with the data source and the processes the retrieved data, reconnects to the data source and writes the modifications.You can create a Cached RowSet object using the createCachedRowSet() method of the RowSetFactory.You can create a RowSetFactory object using the newfactory() method of the RowSetProvider method.Updating a Particular column of a rowThe updateXXX() methods of the CachedRowSet interface allows you to update column values of a particular row in a RowSet object.Get the required row and update the desired column ... Read More

How to insert data into a CachedRowSet in JDBC? Explain?

karthikeya Boyini
Updated on 30-Jul-2019 22:30:25

504 Views

The CachedRowSet is the base implementation of disconnected row sets. It connects to the data source, reads data from it, disconnects with the data source and the processes the retrieved data, reconnects to the data source and writes the modifications.Creating a CachedRowSetYou can create a Cached RowSet object using the createCachedRowSet() method of the RowSetFactory.You can create a RowSetFactory object using the newfactory() method of the RowSetProvider method.Create a CachedRowSet object using the above mentioned methods as shown below −//Creating the RowSet object RowSetFactory factory = RowSetProvider.newFactory(); CachedRowSet rowSet = factory.createCachedRowSet();Connecting to the data sourceAfter creating a RowSet object you ... Read More

What is a CachedRowSet in JDBC? Explain?

Samual Sam
Updated on 30-Jul-2019 22:30:25

2K+ Views

The CachedRowSet is the base implementation of disconnected row sets. It connects to the data source, reads data from it, disconnects with the data source and the processes the retrieved data, reconnects to the data source and writes the modifications.Creating a CachedRowSetYou can create a Cached RowSet object using the createCachedRowSet() method of the RowSetFactory.You can create a RowSetFactory object using the newfactory() method of the RowSetProvider method.Create a CachedRowSet object using the above-mentioned methods as shown below −//Creating the RowSet object RowSetFactory factory = RowSetProvider.newFactory(); CachedRowSet rowSet = factory.createCachedRowSet();Connecting to the data sourceAfter creating a RowSet object you need ... Read More

Is RowSet Scrollable? Explain with an example?

karthikeya Boyini
Updated on 30-Jul-2019 22:30:25

357 Views

A RowSet object is similar to ResultSet, it also stores tabular data, in addition to the features of a ResultSet. A RowSet follows the JavaBeans component model.If you Retrieve a ResultSet object by default the cursor of it moves only in forward direction. i.e. you can retrieve the contents of it from first to last.But, in a scrollable result set, the cursor can scroll forward and backward and you can retrieve data backward too.To make ResultSet object scrollable, you need to create one as shown below −Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);Whereas, a RowSet object is Scrollable by default. Therefore, whenever ... Read More

What is RowSet? How to retrieve contents of a table using RowSet? Explain?

Samual Sam
Updated on 30-Jul-2019 22:30:25

1K+ Views

A RowSet object is similar to ResultSet, it also stores tabular data, in addition to the features of a ResultSet a RowSet follows JavaBeans component model. This can be used as a JavaBeans component in a visual Bean development environment, i.e. in environments like IDE’s you can visually manipulate these properties.Connecting RowSet with databaseThe RowSet interface provides methods to set Java bean properties to connect it to the required database −void setURL(String url):void setUserName(String user_name):void setPassword(String password):PropertiesA RowSet object contains properties and each property have Setter and getter methods. Using these you can set and get values from a command ... Read More

Default virtual behavior in C++ vs Java

Nishtha Thakur
Updated on 30-Jul-2019 22:30:25

126 Views

In C++ methods are non-virtual by default. They can be made virtual function by using a virtual keyword.Example Code#include using namespace std; class B {    public: void s() //non virtual by default. Use virtual before the function to print “In Derived” {       cout

Advertisements