Karthikeya Boyini has Published 2383 Articles

ftp_delete() function in PHP

karthikeya Boyini

karthikeya Boyini

Updated on 30-Jul-2019 22:30:24

79 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 −

Remove all values from TreeMap in Java

karthikeya Boyini

karthikeya Boyini

Updated on 30-Jul-2019 22:30:24

332 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

Java Program to format to 2 decimal places in a 10-character field

karthikeya Boyini

karthikeya Boyini

Updated on 30-Jul-2019 22:30:24

135 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

Get file extension name in Java

karthikeya Boyini

karthikeya Boyini

Updated on 30-Jul-2019 22:30:24

525 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

ftp_fget() function in PHP

karthikeya Boyini

karthikeya Boyini

Updated on 30-Jul-2019 22:30:24

178 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

Get the system properties from RuntimeMXBean in Java

karthikeya Boyini

karthikeya Boyini

Updated on 30-Jul-2019 22:30:24

195 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

Remove all elements from TreeSet in Java

karthikeya Boyini

karthikeya Boyini

Updated on 30-Jul-2019 22:30:24

370 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

ftp_get_option() function in PHP

karthikeya Boyini

karthikeya Boyini

Updated on 30-Jul-2019 22:30:24

59 Views

The ftp_get_option() function returns runtime options of the FTP connection.Syntaxftp_get_option(con, option);Parameterscon − The FTP connection.option − The runtime option to return.The following are the possible values −FTP_TIMEOUT_SEC - The timeout used for network operationsFTP_AUTOSEEK - Returns TRUE if this option is on, FALSE otherwiseReturnThe ftp_get_option() function returns the value on ... Read More

Specify a path for a file or a directory in Java

karthikeya Boyini

karthikeya Boyini

Updated on 30-Jul-2019 22:30:24

3K+ Views

The path for a file can be obtained using the method java.io.File.getPath(). This method returns the abstract pathname in the form of a pathname string and it requires no parameters.A program that demonstrates this is given as follows −Example Live Demoimport java.io.File; public class Demo {    public static void main(String[] ... Read More

Get ClassPath from RuntimeMXBean in Java

karthikeya Boyini

karthikeya Boyini

Updated on 30-Jul-2019 22:30:24

86 Views

RuntimeMXBean in the management interface for the runtime system of the Java virtual machine.RuntimeMXBean runtimeMX = ManagementFactory.getRuntimeMXBean();To get the class path, use the getClassPath() method −runtimeMX.getClassPath()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 void main(String args[]) throws ... Read More

Advertisements