Changes
Jump to navigation
Jump to search
← Older edit
Newer edit →
Java
(view source)
Revision as of 09:23, 28 April 2022
326 bytes added
,
09:23, 28 April 2022
m
→Writing files
Line 3:
Line 3:
===With apt===
===With apt===
<nowiki>sudo apt-add-repository ppa:webupd8team/java
<nowiki>sudo apt-add-repository ppa:webupd8team/java
−
sudo apt-get update
+
sudo apt-get update
−
sudo apt-get install oracle-java8-installer</nowiki>
+
sudo apt-get install oracle-java8-installer</nowiki>
Also ensure your JAVA_HOME variable has been set to:
Also ensure your JAVA_HOME variable has been set to:
Line 887:
Line 887:
}</source>
}</source>
−
=== with nio ===
+
===with nio===
<syntaxhighlight lang="java">
<syntaxhighlight lang="java">
import java.io.IOException;
import java.io.IOException;
Line 939:
Line 939:
}
}
−
}</source>
+
}</source
><syntaxhighlight lang="java">
+
import java.io.IOException;
+
+
public class FileWriteRunner {
+
public static void main(String[] args){
+
Path filePath = Paths.get("./resources/filetowrite.txt");
+
List<String> list = List.of("Apfel", "Junge", "Hund");
+
Files.write(filePath, list);
+
}
+
}
+
</syntaxhighlight
>
==Anonymous class==
==Anonymous class==
Rafahsolis
Bureaucrats
,
Administrators
2,306
edits
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
Variants
Views
Read
View source
View history
More
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
Special pages
Printable version