Java ResultSet next() Method with Example

Arushi
Updated on 31-May-2024 13:53:59

26K+ Views

When we execute certain SQL queries (SELECT query in general) they return tabular data.The java.sql.ResultSet interface represents such tabular data returned by the SQL statements.i.e. the ResultSet object holds the tabular data returned by the methods that execute the statements which quires the database (executeQuery() method of the Statement interface in general).The ResultSet object has a cursor/pointer which points to the current row. Initially this cursor is positioned before first row.The next() method of the ResultSet interface moves the pointer of the current (ResultSet) object to the next row, from the current position.Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("Select ... Read More

Convert Contents of a Map to List in Java

Ankith Reddy
Updated on 31-May-2024 13:36:10

32K+ Views

The Map class's object contains key and value pairs. You can convert it into two list objects one which contains key values and the one which contains map values separately. To convert a map to list − Create a Map object. Using the put() method insert elements to it as key, value pairs Create an ArrayList of integer type to hold the keys of the map. In its constructor call the method keySet() of the Map class. Create an ArrayList of String type to hold the values of the map. In ... Read More

Calculate Body Mass Index (BMI) in Java

Samual Sam
Updated on 31-May-2024 13:04:55

30K+ Views

The Body Mass Index is the body mass in kilogram divided by the square of body height in meters. This is expressed as kg/m^2.A Java program that calculates the Body Mass Index (BMI) is given as follows.Exampleimport java.util.Scanner; public class Example {    public static void main(String args[]) {       Scanner sc = new Scanner(System.in);       System.out.print("Input weight in kilogram: ");       double weight = sc.nextDouble();       System.out.print("Input height in meters: ");       double height = sc.nextDouble();       double BMI = weight / (height * height);     ... Read More

Need for Computer Network

Mr. Satyabrata
Updated on 31-May-2024 12:29:29

13K+ Views

In the modern era, computers have become a vital component of both commercial and private operations in the industry sector. As technological developments have accelerated, networking has become increasingly important. We have gradually transitioned from the first wired network technology to wireless networking technology. If we look at it now, we can see that networking affects everything. A computer network is a collection of interrelated devices that can share resources and exchange data with one another. A network's devices can be physically connected with wires or wirelessly with the help of radio waves or infrared signals. These devices employ a ... Read More

Import Other Python Files

Rajendra Dharmkar
Updated on 31-May-2024 12:20:05

98K+ Views

The task or process of importing other files in Python allows you to use functions, classes, or variables defined in those files within your current Python script. In this article, we will explore different ways to import other Python files, including built-in modules, user-defined modules, and importing specific functions or variables. By the end of this article, you will have a solid understanding of how to import and use code from other Python files in your current projects. Along the way, we will use code examples followed by lucid explanations to help you understand the above task. Importing a User-Defined ... Read More

Pass Command Line Arguments to a Python Docker Container

Hemant Sharma
Updated on 31-May-2024 12:15:05

16K+ Views

Before getting into the docker container arguments we must know about python command line arguments and how they are accessed by the developer. Command line arguments are of great use when we want our python script to be controlled outside of the program. Access the python script’s command line arguments Step 1: Create a python script main.py Example # sys will allow us to access the passed arguments import sys # sys.argv[0] access the first argument passed that is the python script name print("File or Script Name is :", sys.argv[0]) # print arguments other than the file name ... Read More

Install Tkinter in Python

pawandeep
Updated on 31-May-2024 12:07:26

647K+ Views

Tkinter is a standard library in Python which is used for GUI application. Tkinter has various controls which are used to build a GUI-based application.To install Tkinter, we need Python pre-installed. Tkinter actually comes along when we install Python. While installing Python, we need to check the td/tk and IDLE checkbox. This will install the tkinter and we need not install it separately.However, if we missed installing Tkinter while installing Python, we can do it later using the pip command.Step 1 − Make sure Python and pip is preinstalled on your systemType the following commands in command propmt to check ... Read More

Full Form of ISC

Shirjeel Yunus
Updated on 30-May-2024 12:19:06

401 Views

What is ISC? The full form of ISC is Indian School Certificate. ISC is an examination which is conducted by CISCE for students of class 12 all over India. ISC exam is similar to the exam of class XII conducted by ICSE. The exam has been made valid by the government of India and other countries. Students who have completed their high school are eligible to take this exam which is conducted by the Council for the Indian School Certificate Examination (CISCE). CISCE is an independent and non-government board of India. UGC (University Grants Commission) and the government of India ... Read More

Containers in C++ STL

sudhir sharma
Updated on 29-May-2024 13:11:59

1K+ Views

The C++ STL (Standard Template Library) is a powerful set of C++ template classes to provide general-purpose classes and functions with templates that implement many popular and commonly used algorithms and data structures like vectors, lists, queues, and stacks.It is a library of container classes, algorithms, and iterators. It is a generalized library and so, its components are parameterized. Working knowledge of template classes is a prerequisite for working with STL.Templates are a feature of the C++ programming language that allows functions and classes to operate with generic types. This allows a function or class to work on many different ... Read More

Use Pandas DataFrame Tail Function

Vani Nalliappan
Updated on 27-May-2024 11:21:00

695 Views

Write a Python code to find price column value between 30000 to 70000 and print the id and product columns of the last three rows from the products.csv file. Result for price column value between 30000 to 70000 and id and product columns last three rows are −    id product 79 80 Truck 81 82 Bike 98 99 TruckSolution 1 Read data from products.csv file and assign to dfdf = pd.read_csv('products.csv ')Apply pandas slicing to access all rows of price column between 30000 to 50000 as, df[df.iloc[:, 4].between(30000, 50000)Save the above result to df1Apply slicing to access last ... Read More

Advertisements