全部 新建

user:thomas 由使用者建立的 Gists

title:mygist Gists 的標題

filename:myfile.txt Gists 的檔案名稱

extension:yml Gists 的副檔名

language:go Gists 的程式語言

登錄


全部 新建

所有 Gists

倒序排序 創建
順序排序 創建
倒序排序 更新
順序排序 更新
kristofer's Avatar

kristofer / Hmm-Phi3andCards.md

0 喜歡
0 分支
1 檔案
最後活躍 1719340749

So I asked Phi3...

To generate some code like we talked about with Deal.java

Read this code.

To create a Java program that models a deck of cards, we'll define two main components: Card (using an enum to represent suits and ranks) and Hand (to hold a collection of cards). We will also implement a Deck class that initializes with all possible combinations of these cards.

Step 1: Define the Card Enum

First, we define an enum for both the suit and rank to represent each card uniquely.

kristofer's Avatar

kristofer / SpaceInvadersGame.java

0 喜歡
0 分支
1 檔案
最後活躍 1719509743
1 import javax.swing.*;
2 import java.awt.*;
3 import java.awt.event.ActionEvent;
4 import java.awt.event.ActionListener;
5 import java.awt.event.KeyEvent;
6 import java.awt.event.KeyListener;
7 import java.util.ArrayList;
8 import java.util.List;
9 import java.util.Random;
kristofer's Avatar

kristofer / SortingExamples.java

0 喜歡
0 分支
1 檔案
最後活躍 1718984838
1 import java.util.Arrays;
2 import java.util.Scanner;
3
4 public class SortingExamples {
5 public static void main(String[] args) {
6 Scanner input = new Scanner(System.in);
7
8 // Input array from the user
9 System.out.print("Enter the number of elements in the array: ");
10 int n = input.nextInt();
kristofer's Avatar

kristofer / UrlShortener.java

0 喜歡
0 分支
1 檔案
最後活躍 1718984693
1 import java.security.MessageDigest;
2 import java.security.NoSuchAlgorithmException;
3 import java.util.HashMap;
4 import java.util.Map;
5 import java.util.Random;
6
7 public class UrlShortener {
8 private Map<String, String> urlMap = new HashMap<>();
9 private static final String BASE_URL = "http://short.url/";
kristofer's Avatar

kristofer / WeatherApp.java

0 喜歡
0 分支
1 檔案
最後活躍 1718984504
1 import java.io.BufferedReader;
2 import java.io.IOException;
3 import java.io.InputStreamReader;
4 import java.net.HttpURLConnection;
5 import java.net.URL;
6
7 // go to https://openweathermap.org to see
8
9
10 public class WeatherApp {
kristofer's Avatar

kristofer / NotesApp.java

0 喜歡
0 分支
1 檔案
最後活躍 1718984355
1 import java.io.*;
2 import java.util.ArrayList;
3 import java.util.Scanner;
4
5 class Note {
6 private String title;
7 private String content;
8
9 public Note(String title, String content) {
10 this.title = title;
kristofer's Avatar

kristofer / NQueenProblem.java

0 喜歡
0 分支
1 檔案
最後活躍 1718984322
1 // Java program to solve N Queen Problem using backtracking
2
3 public class NQueenProblem {
4 final int N = 4;
5
6 // A utility function to print solution
7 void printSolution(int board[][])
8 {
9 for (int i = 0; i < N; i++) {
10 for (int j = 0; j < N; j++) {
kristofer's Avatar

kristofer / Minesweeper.java

0 喜歡
0 分支
1 檔案
最後活躍 1718984273
1 import java.util.Random;
2 import java.util.Scanner;
3
4 public class Minesweeper {
5 private static final int SIZE = 10;
6 private static final int MINES = 15;
7
8 private char[][] board;
9 private boolean[][] mines;
10 private boolean[][] revealed;
kristofer's Avatar

kristofer / IntersectionOfTwoArrays.java

0 喜歡
0 分支
1 檔案
最後活躍 1718984169
1 import java.util.*;
2
3 public class IntersectionOfTwoArrays {
4 public static void main(String args[])
5 {
6 Scanner sc=new Scanner(System.in);
7 HashSet<Integer>s=new HashSet<Integer>();
8 System.out.println("Enter the no. of elements in array a");
9 int n1=sc.nextInt();
10 System.out.println("Enter the no. of elements in array b");
kristofer's Avatar

kristofer / InterfaceDemo.java

0 喜歡
0 分支
1 檔案
最後活躍 1718984132
1 interface Shape {
2 double area();
3 double perimeter();
4 }
5
6 class Circle implements Shape {
7 private double radius;
8
9 public Circle(double radius) {
10 this.radius = radius;
上一頁 下一頁

由 Opengist 提供支持 ⋅ Load: 170ms⋅

繁體中文
Čeština Deutsch English Español Français Magyar Português Русский 中文 繁體中文