This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Pahlawan extends React.Component { | |
state = { tampil:true };//Menginisialisasi state tampil=true sebagai nilai awal | |
componentDidMount(){ | |
setInterval(() => ( //Berfungsi untuk memanggil fungsi secara berulang-ulang | |
this.setState({ tampil: !this.state.tampil })//Mengubah state menjadi nilai inversnya | |
), 1000);//Delay dalam miliseconds 1000ms = 1 detik. | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { StyleSheet, Text, View } from 'react-native'; | |
//Custom Component bernama Pahlawaan | |
class Pahlawan extends React.Component { | |
render(){ | |
return ( | |
<View> | |
{/* Menampilkan props 'nama' yang dikirimkan oleh Parentnya. */} | |
<Text>{this.props.nama}</Text> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Image source={pic} style={{width: 193, height: 110}}/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { StyleSheet, Text, View } from 'react-native'; | |
export default class App extends React.Component { | |
render() { | |
return ( | |
<View style={styles.container}> | |
<Text>Hello World!</Text> | |
</View> | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const http = require('http'); | |
const hostname = '127.0.0.1'; | |
const port = 3000; | |
const server = http.createServer((req, res) => { | |
res.statusCode = 200; | |
res.setHeader('Content-Type', 'text/plain'); | |
res.end('Hello World\n'); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package galihlprakoso.com.solidprinciple; | |
import java.util.ArrayList; | |
import java.util.List; | |
/** | |
* | |
* @author galihlarasprakoso | |
*/ | |
interface PekerjaBangunan { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package galihlprakoso.com.solidprinciple; | |
/** | |
* | |
* @author galihlarasprakoso | |
*/ | |
//Implementasi yang tidak memenuhi prinsip | |
interface InteraksiPenggunaDenganLayar { | |
void menekan(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package galihlprakoso.com.solidprinciple; | |
/** | |
* | |
* @author galihlarasprakoso | |
*/ | |
class AlatMusik { | |
public void berbunyi(){ | |
System.out.println("Bunyi alat musik..."); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package galihlprakoso.com.solidprinciple; | |
/** | |
* | |
* @author galihlarasprakoso | |
*/ | |
//Contoh yang tidak menggunakan | |
//Open/Closed Principle |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package galihlprakoso.com.solidprinciple; | |
import java.text.NumberFormat; | |
import java.util.ArrayList; | |
import java.util.Locale; | |
/** | |
* | |
* @author galihlarasprakoso | |
*/ |