import java.io.*;
public class DirList
{
public static void main(String[] args)
{ File f = new File(args[0]);
if(f.isDirectory())
{ String[] files = f.list();
for(String each: files)
System.out.println(each);
}
File f1 = new File(f,"/sub");
f1.mkdir();
}
}
import java.io.*;
public class ConsoleDemo
{
public static void main(String[] args)
{
Console c = System.console();
if(c == null)
return;
String s = c.readLine("Enter a String: ");
char[] p = c.readPassword("Enter a Password: ");
String pw = String.valueOf(p);
System.out.println("Entered Details: "+s+", "+pw);
}
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter