Skip to content

Instantly share code, notes, and snippets.

View mangkoran's full-sized avatar
🗿
🗿🗿🗿🗿

mangkoran mangkoran

🗿
🗿🗿🗿🗿
View GitHub Profile
// Name: Afiq Nazrie Rabbani
// Matric: A19EC0216
class TrialTest {
public static void main(String[] a) {
Trial ac = new Trial(5, "Five");
// ac.a = 10; //The field Trial.a is not visible
// ac.b = "Ten"; //The field Trial.b is not visible
ac.setAB(10, "Ten"); //Use setter
ac.setAB(6, "Six");
// Name: Afiq Nazrie Rabbani
// Matric: A19EC0216
public class Test1 {
public static void main(String[] args) {
T t1 = new T();
System.out.print("t1's static i=" + t1.i);
System.out.println(" and instance j=" + t1.j);
T t2 = new T();
System.out.print("t2's static i=" + t2.i);
@mangkoran
mangkoran / Product.java
Last active April 18, 2021 08:34
OOP Java Array Tutorial
public class Product {
public static void main(String[] args) {
calculate(1);
calculate(1, 2);
calculate(1, 2, 3);
calculate(1, 2, 3, 4);
}
public static void calculate(int ... i) {
int sum = 0;
@mangkoran
mangkoran / hosts
Created May 7, 2021 03:52
Hosts file dump 07-05-2021
This file has been truncated, but you can view the full file.
# This hosts file has been generated by AdAway on: 2021-05-07 11:43:27
# Please do not modify it directly, it will be overwritten when AdAway is applied again.
# This file is generated from the following sources:
# - AdAway official hosts:https://adaway.org/hosts.txt
# - Pete Lowe blocklist hosts:https://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=0&mimetype=plaintext
# - StevenBlack Unified hosts:https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts
# - bebasid:https://raw.githubusercontent.com/bebasid/bebasid/master/releases/hosts
127.0.0.1 localhost
::1 localhost
@mangkoran
mangkoran / service
Last active November 17, 2021 08:45
/usr/bin/service
#!/bin/sh
###########################################################################
# /usr/bin/service
#
# A convenient wrapper for the /etc/init.d init scripts.
#
# This script is a modified version of the /sbin/service utility found on
# Red Hat/Fedora systems (licensed GPLv2+).
#
# EditorConfig is awesome: https://EditorConfig.org
# https://github.com/mdn/kuma/blob/master/.editorconfig
# Top-most EditorConfig file ?
root = true
# Unix-style newlines with a newline ending every file
[*]
charset = utf-8
end_of_line = lf
  1. Write a Bash script that prompts the user to enter her favourite animal and favourite cartoon character and displays the entered output in a message on the terminal.
read -p "What's your favourite animal? " favanimal
read -p "What's your cartoon character? " favchar

echo "Your favourite animal is" $favanimal
echo "Your cartoon character is is" $favchar
  1. Write a Bash script that creates the following directory structure: