CodeGym /Kursus Jawa /Sintaksis Jawa /Jeneng kelas lengkap

Jeneng kelas lengkap

Sintaksis Jawa
tingkat , wulangan
kasedhiya
Jeneng kelas lengkap - 1

"Halo, Amigo. Aku arep ngomong babagan jeneng kelas lengkap."

"Minangka sampeyan wis ngerti, kelas disimpen ing paket. Dadi, jeneng lengkap kelas kalebu jeneng kabeh paket, dipisahake karo titik, lan jeneng kelas. Ing ngisor iki sawetara conto : "

Jeneng kelas Jeneng paket jeneng lengkap
String
jawa.lang jawa.lang. String
FileInputStream
java.io java.io. FileInputStream
ArrayList
java.util java.util. ArrayList
IOException
java.io java.io. IOException ;

"Kanggo nggunakake kelas ing kode sampeyan, sampeyan kudu nunjukake jeneng lengkap. Sampeyan uga bisa nggunakake jeneng sing cendhak, yaiku mung jeneng kelas, nanging sampeyan kudu 'ngimpor kelas'. Iki tegese sadurunge ngumumake sampeyan kelas, sampeyan nuduhake tembung impor banjur jeneng kelas sing pengin diimpor. Kelas saka paket java.lang diimpor kanthi standar, dadi sampeyan ora perlu ngimpor. Iki conto:"

Nama Lengkap Kelas :
package com.codegym.lesson2;

public class FileCopy2
{
    public static void main(String[] args) throws java.io.IOException
    {
        java.io.FileInputStream fileInputStream =
                        new java.io.FileInputStream("c:\\data.txt");
        java.io.FileOutputStream fileOutputStream =
                        new java.io.FileOutputStream("c:\\result.txt");

        while (fileInputStream.available() > 0)
        {
            int data = fileInputStream.read();
            fileOutputStream.write(data);
        }

        fileInputStream.close();
        fileOutputStream.close();
    }
}

"Iki conto sing nggunakake jeneng singkat:"

Jeneng kelas singkat:
package com.codegym.lesson2;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

public class FileCopy
{
    public static void main(String[] args) throws IOException
    {
        FileInputStream fileInputStream =
                        new FileInputStream("c:\\data.txt");
        FileOutputStream fileOutputStream =
                        new FileOutputStream("c:\\result.txt");

        while (fileInputStream.available() > 0)
        {
            int data = fileInputStream.read();
            fileOutputStream.write(data);
        }

        fileInputStream.close();
        fileOutputStream.close();
    }
}

"Ngerti."

"Apik."

Komentar
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION