Vikyath Ram has Published 173 Answers

Member variables vs Local variables in Java

Vikyath Ram

Vikyath Ram

Updated on 24-Feb-2020 05:31:57

Local VariableLocal variables are declared in methods, constructors, or blocks.Local variables are created when the method, constructor or block is entered and the variable will be destroyed once it exits the method, constructor, or block.Access modifiers cannot be used for local variables.Local variables are visible only within the declared method, ... Read More

How do you check if a ResultSet is empty or not in JDBC?

Vikyath Ram

Vikyath Ram

Updated on 21-Feb-2020 10:51:41

Whenever we execute SQL statements using the executeQuery() method, it returns a ResultSet object which holds the tabular data returned by the SELECT queries(in general).The ResultSet object contains a cursor/pointer which points to the current row. Initially this cursor is positioned before first row (default position).The next() methodThe next() method of ... Read More

How to extract the last n characters from a string using Java?

Vikyath Ram

Vikyath Ram

Updated on 20-Feb-2020 04:47:44

To extract last n characters, simply print (length-n)th character to nth character using the charAt() method.ExampleLive Demopublic class ExtractingCharactersFromStrings {    public static void main(String args[]) {           String str = "Hi welcome to tutorialspoint";       int n = 5;       int ... Read More

How to count the number characters in a Java string?

Vikyath Ram

Vikyath Ram

Updated on 20-Feb-2020 04:43:25

Declare an integer, initialize it with 0, in for loop increment it for each character.ExampleLive Demopublic class Sample {    public static void main(String args[]) {       String str = new String("Hi welcome to Tutorialspoint");       int count = 0;       for(int i ... Read More

How to concatenate two strings using Java?

Vikyath Ram

Vikyath Ram

Updated on 19-Feb-2020 12:50:01

You can concatenate two Strings using the concat() method.ExampleLive Demopublic class ConcatinatedStrings {    public static void main(String args[]) {             String str1 = new String("Tutorials");       String str2 = new String( "Point");       String res = str1.concat(str2);       ... Read More

What is type deduction in C++?

Vikyath Ram

Vikyath Ram

Updated on 11-Feb-2020 07:52:46

Type inference or deduction refers to the automatic detection of the data type of an expression in a programming language. It is a feature present in some strongly statically typed languages. In C++, the auto keyword(added in C++ 11) is used for automatic type deduction. For example, you want to ... Read More

How can we add columns with default values to an existing MySQL table?

Vikyath Ram

Vikyath Ram

Updated on 29-Jan-2020 05:42:28

While adding columns to an existing table with the help of ALTER command we can specify the default value also.SyntaxAlter table table-name ADD (column-name datatype default data);ExampleIn the example below, with the help of ALTER Command, column ‘City’ is added with default value ‘DELHI’ to the table ‘Student’.mysql> Alter table ... Read More

In case of FOREIGN KEY constraint, what kind of relationship is there between MySQL parent and child tables?

Vikyath Ram

Vikyath Ram

Updated on 28-Jan-2020 07:11:41

The relationship between parent and child table is One-to-Many relationship. It can be understood with the example of two tables named ‘customer’ and ‘orders’. Here, ‘customer’ is the parent table and ‘orders’ is the child table. The relationship is one-to—many because a customer can have more than one order. It ... Read More

How to set the color of the outline around an element with JavaScript?

Vikyath Ram

Vikyath Ram

Updated on 24-Jan-2020 06:47:38

To set the outline color, use the outlineColor property. You can try to run the following code to set the color of the outline around an element with JavaScript:ExampleLive Demo<!DOCTYPE html> <html>    <head>       <style>          #box {             ... Read More

How to add background music to your web page?

Vikyath Ram

Vikyath Ram

Updated on 10-Jan-2020 11:24:48

To add background music on a web page, use <embed>…</embed> element. Also, use the autoplay attribute. This will run music in the background whenever the page loads.Set the width and height in a way the player hides on the web page. The loop attribute is added to specify whether the ... Read More

Previous 1 ... 6 7 8 9 10 11 12 ... 18 Next
Advertisements