usingnamespacestd; intmain () { ofstream filestream("testout.txt"); if(filestream.is_open()) { filestream <<"Welcome to javaTpoint.\n"; filestream <<"C++ Tutorial.\n"; filestream.close(); } elsecout <<"File opening is fail."; return0; } Output: The content of a text filetesto...
Parameter in Applet Applet Communication Java Reflection Reflection API newInstance() method javap tool creating javap tool creating appletviewer Call private method Java Conversion Java String to int Java int to String Java String to long Java long to String Java String to float Java float to String...
What is a parallel stream in Java? Usually, Java code has one stream of processing that executes in sequence. On the other hand, by using the parallel stream, we can divide chunks of code into streams that execute in parallel on multiple cores. The final result is the grouping of the di...
package com.javatpoint; import java.io.*; public class DataStreamExample { public static void main(String args[])throws Exception{ FileOutputStream fout1=new FileOutputStream("D:\\f1.txt"); FileOutputStream fout2=new FileOutputStream("D:\\f2.txt"); ByteArrayOutputStream bout=new ByteAr...
import java.io.*; public class ObjectInputStreamreadExample2 { public static void main(String[] args) { try { FileInputStream instream = new FileInputStream("file1.txt"); ObjectInputStream objinstream = new ObjectInputStream(instream); String str=objinstream.toString(); FileOutputStream ...
Exception in thread "main" java.net.SocketException: Socket is closed at java.net.Socket.getOutputStream(Socket.java:943) at com.javaTpoint.JavaSocketGetOutputStreamExample2.main(JavaSocketGetOutputStreamExample2.java:22) Example 3 importjava.io.DataOutputStream; ...
file=newFile("./JavaTpoint.txt"); file.createNewFile(); System.out.println("Enter a string to get the file channel--->"); sc=newScanner (System.in); //taking a string from the user and convert it into char Array char[] s= sc.nextLine().toCharArray(); // ...
Hello JavaTpoint .com Example 2 importjava.io.*; publicclassReadUTFdemo { publicstaticvoidmain(String[] args)throwsIOException { String[] s = {"A","BB","CCC"}; try{ DataOutputStream doutput=newDataOutputStream(newFileOutputStream(newFile("./Demo.txt"))); ...
they don't check for validity, which leaves them open to insertions. If hackers defeat the encryption algorithm, they are able to add to or change the encrypted message without being noticed. Stream ciphers are typically used to encrypt data in an application where the volume of plain text ca...
Parameter in Applet Applet Communication Java Reflection Reflection API newInstance() method javap tool creating javap tool creating appletviewer Call private method Java Conversion Java String to int Java int to String Java String to long Java long to String Java String to float Java float to String...