Populer Posts Hari ini
Popular Posts
-
Java Inputan / Ouput Kumpulan Source Code dengan Bahasa Java IF ...
-
#include <stdio.h> #include <conio.h> #include <stdlib.h> void main() { int musuh,player; char ulang; rand...
-
Perulangan For yaitu perulangan yang dilakukan ketika kondisi kapan perulangan dihentikan dan banyaknya proses perulang...
-
#include <stdio.h> #include <stdlib.h> void DesimalToBiner(int N){ if(N>1){ DesimalToBiner(N/2); } ...
-
1. Insertion Sort 2. Buble Sort 3. Shell Sort 4. Quick Sort 5. Pengurutan Matriks
-
Contoh Kombinasi Misalkan dalam suatu tim terdapat 4 orang alhli statistik yang sedang melakukan proyek survey. Dalam pr...
-
Apa itu Eksepsi ??? Eksepsi adalah kesalahan-kesalahan yang terjadi pada saat program sedang dijalankan atau suatu objek ya...
-
Kalkulator adalah alat bantu hitung elektronik yang banyak digunakan oleh masyarakat. untuk melakukan perhitun...
-
Faktorial dari bilangan asli n adalah hasil perkalian antara bilangan bulat positif yang kurang dari atau sama dengan...
-
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templat...
Powered by Blogger.
Labels
Lorem 1
adsense
"
});
Circle Gallery
"
});
‹
›
News
"
});
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package classobjects;
class Student{
int Nim;
String Nama;
int Umur;
public void setNim(int N){
this.Nim=N;
}
public void setNama(String N){
this.Nama=N;
}
public void setUmur(int U){
this.Umur=U;
}
public void InfoStudent(){
System.out.println("Nim \t:"+Nim);
System.out.println("Nama \t:"+Nama);
System.out.println("Umur \t:"+Umur);
}
}
/**
*
* @author andi m
*/
public class ClassObjects {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Student A=new Student();
A.setNim(2343216);
A.setNama("Andy Moer");
A.setUmur(19);
A.InfoStudent();
}
}
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package classobjects;
class Student{
int Nim;
String Nama;
int Umur;
public void setNim(int N){
this.Nim=N;
}
public void setNama(String N){
this.Nama=N;
}
public void setUmur(int U){
this.Umur=U;
}
public void InfoStudent(){
System.out.println("Nim \t:"+Nim);
System.out.println("Nama \t:"+Nama);
System.out.println("Umur \t:"+Umur);
}
}
/**
*
* @author andi m
*/
public class ClassObjects {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Student A=new Student();
A.setNim(2343216);
A.setNama("Andy Moer");
A.setUmur(19);
A.InfoStudent();
}
}
class.constructor - java
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package constructorjava;
class LuasSegitiga{
int panjang;
int tinggi;
int lebar;
public void LuasSegitiga(int p,int l,int t){
this.panjang=p;
this.lebar=l;
this.tinggi=t;
}
public int luas(){
return (panjang*tinggi*lebar);
}
}
/**
*
* @author andi m
*/
public class ConstructorJava {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
LuasSegitiga A=new LuasSegitiga();
A.LuasSegitiga(4, 4, 4);
System.out.println(A.luas());
}
}
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package constructorjava;
class LuasSegitiga{
int panjang;
int tinggi;
int lebar;
public void LuasSegitiga(int p,int l,int t){
this.panjang=p;
this.lebar=l;
this.tinggi=t;
}
public int luas(){
return (panjang*tinggi*lebar);
}
}
/**
*
* @author andi m
*/
public class ConstructorJava {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
LuasSegitiga A=new LuasSegitiga();
A.LuasSegitiga(4, 4, 4);
System.out.println(A.luas());
}
}
class.constructor - java
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package prosedurdanfungsi;
/**
*
* @author andi m
*/
public class ProsedurDanFungsi {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
jumlah(5,5,5);
System.out.println(jumlahFungsi(5,5,5));
}
//prosedur
public static void jumlah(int a,int b,int c){
System.out.println(a+b+c);
}
//fungsi
public static int jumlahFungsi(int a,int b,int c){
return a+b+c;
}
}
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package prosedurdanfungsi;
/**
*
* @author andi m
*/
public class ProsedurDanFungsi {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
jumlah(5,5,5);
System.out.println(jumlahFungsi(5,5,5));
}
//prosedur
public static void jumlah(int a,int b,int c){
System.out.println(a+b+c);
}
//fungsi
public static int jumlahFungsi(int a,int b,int c){
return a+b+c;
}
}
fungsi - java - prosedur
package tahunkabisat;
import java.util.Scanner;
public class Tahunkabisat {
public static void main(String[] args) {
int tahun;
Scanner input = new Scanner(System.in);
System.out.print("tahun =");
tahun =input.nextInt();
if((tahun %100 != 0 || tahun%400==0 )&& (tahun %4==0)){
System.out.println(tahun+ " adalah tahun kabisat");
}
else{
System.out.println(tahun+ " adalah bukan kabisat ");
}
}
}
if - java - matematika
package input;
import java.util.Scanner;
public class Input {
public static void main(String args[]){
Scanner input = new Scanner( System.in );
System.out.print( "Nama: " );
String nama = input.next();
System.out.print( "Umur: " );
int umur = input.nextInt();
System.out.println("Hello "+nama);
System.out.println("Umur kamu : "+umur);
}
}
input/output - java
Subscribe to:
Posts (Atom)