
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Karthikeya Boyini has Published 2193 Articles

karthikeya Boyini
1K+ Views
To count number of positive and negative votes, you can use CASE statement along with aggregate function SUM().Let us first create a table −mysql> create table DemoTable ( Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, Vote int ); Query OK, 0 rows affected (1.70 sec)Insert some records in ... Read More

karthikeya Boyini
9K+ Views
An element in an ArrayList can be searched using the method java.util.ArrayList.indexOf(). This method returns the index of the first occurance of the element that is specified. If the element is not available in the ArrayList, then this method returns -1.A program that demonstrates this is given as follows −Example Live ... Read More

karthikeya Boyini
115 Views
The ftp_close() function closes an FTP connection.Syntaxftp_close(con);Parameterscon − The connection to close.ReturnThe ftp_close() function returns TRUE on success or FALSE on failureExampleThe following is an example that login to a connection, works in it to change the directory and then connection is closed −

karthikeya Boyini
155 Views
The ftp_delete() function is used to delete a file on the FTP server.Syntaxftp_delete(con,myfile);Parameterscon − The FTP connectionmyfile − The file to be deletedReturnThe ftp_delete() function returns TRUE on success or FALSE on failureExampleThe following is an example to delete a file −

karthikeya Boyini
456 Views
Use the clear() method to remove all values from TreeMap.Let us first create a TreeMap −TreeMap m = new TreeMap();Add some elements to the TreeMap −m.put(1, "PHP"); m.put(2, "jQuery"); m.put(3, "JavaScript"); m.put(4, "Ruby"); m.put(5, "Java"); m.put(6, "AngularJS"); m.put(7, "ExpressJS");Let us now remove all the values −m.clear();The following is an example ... Read More

karthikeya Boyini
175 Views
To format, use the Formatter class. Import the following package to work with the Formatter class in Java −import java.util.Formatter;Create a Formatter object and format to 2 decimal places in a 10-character field −Formatter f = new Formatter(); System.out.println(f.format("%10.2e", 3989.7886));The following is the complete example −Example Live Demoimport java.util.Formatter; public class ... Read More

karthikeya Boyini
654 Views
The file extension is the suffix that is attached to the computer file and it denotes the format of the file. A program that demonstrates getting the file extension name is given as follows −Example Live Demoimport java.io.File; public class Demo { private static String fileExtension(File file) { ... Read More

karthikeya Boyini
264 Views
The ftp_fget() function is used to downloads file from the FTP server and save it into an open local fileSyntaxftp_fget(con, open_file, server_file, mode, startpos);Parameterscon − The FTP connectionopen_file − A file where the data is storedserver_file − The server file to downloadmode − The transfer modestartpos − The position to ... Read More

karthikeya Boyini
353 Views
RuntimeMXBean in the management interface for the runtime system of the Java virtual machine.RuntimeMXBean runtimeMX = ManagementFactory.getRuntimeMXBean();To get the system properties, use the getSystemProperties() method −System.out.println("System properties from RuntimeMXBean: "+runtimeMX.getSystemProperties());The following is an example −Example Live Demoimport java.lang.management.ManagementFactory; import java.lang.management.RuntimeMXBean; import java.util.Date; public class Demo { public static ... Read More

karthikeya Boyini
495 Views
Use the clear() method to remove all elements from TreeSet.First, create a TreeSet and add elements −TreeSet set = new TreeSet(); set.add("65"); set.add("45"); set.add("19"); set.add("27"); set.add("89"); set.add("57");Now, remove all the elements −set.clear();The following is an example to remove all elements from TreeSet −Example Live Demoimport java.util.*; public class Demo { ... Read More