package javaapplication6;
import java.util.*;
public class JavaApplication6{
public static void main(String[] args){
Scanner vh=new Scanner(System.in);
String niz="";
char pod_niz=vh.next().charAt(0);
char pod_niz2=vh.next().charAt(0);
int index=niz.indexOf(pod_niz);
String m=niz.replace(niz.charAt(index),pod_niz2);
System.out.println(m);
}
}
So this program changes one letter from a string.So for example:
String niz="monkey";
char pod_niz='y';
char pod_niz='x';
I get monkex
Now i have a file (D:\file.bin) and i want to change it to File.bin using this program. How to do that? Maybe I need to store the file name into a String, change it, then change the file name using the data which the String contains.
Thanks..