0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

表で参照するプログラミング言語

Last updated at Posted at 2025-08-17

📊 言語別 基本文法・メソッド比較表(非JS系)

概念 / 操作 Java Python Go Ruby PHP Kotlin Swift
拡張子 .java .py .go .rb .php .kt .swift
出力 System.out.println() print() fmt.Println() puts echo println() print()
変数宣言 int x = 1; x = 1 x := 1 x = 1 $x = 1; var x: Int = 1 var x = 1
関数定義 void foo(){} def foo(): func foo(){} def foo ... end function foo(){} fun foo(){} func foo(){}
配列 / リスト作成 int[] arr={1,2,3}; [1,2,3] []int{1,2,3} [1,2,3] [1,2,3] listOf(1,2,3) [1,2,3]
ループ for(int x: arr){} for x in arr: for _,x:=range arr{} `arr.each do x ` foreach($arr as $x){}
条件分岐 if(x>0){} if x>0: if x>0 {} if x > 0 ... end if($x>0){} if(x>0){} if x>0 {}
非同期処理 CompletableFuture async def foo(): go func(){} Thread.new {} curl_multi_exec / Guzzle coroutines (suspend) async/await
HTTPリクエスト HttpClient.send(...) requests.get(url) http.Get(url) Net::HTTP.get(url) file_get_contents(url) / Guzzle HttpClient / Ktor URLSession.shared.dataTask
クラス class Foo{} class Foo: type Foo struct{} class Foo ... end class Foo {} class Foo{} class Foo{}
モジュールインポート import java.util.*; import os import "fmt" require 'net/http' require "file.php" import kotlin.* import Foundation

📊 フロントエンド・JS系 フレームワーク比較表

概念 / 操作 TypeScript React Next.js React Native Vue.js
拡張子 .ts / .tsx .jsx / .tsx .jsx / .tsx .jsx / .tsx .vue
出力 console.log() console.log() console.log() console.log() console.log()
変数宣言 let x: number = 1; useState(1) useState(1) useState(1) ref(1) / reactive()
関数定義 function foo(): void {} function Foo(){} function Page(){} function Foo(){} setup(){} / methods:{}
配列 / リスト作成 [1,2,3] [1,2,3].map(...) [1,2,3].map(...) [1,2,3].map(...) ref([1,2,3])
ループ for(const x of arr){} {arr.map(x=>...)} {arr.map(x=>...)} {arr.map(x=>...)} v-for="x in arr"
条件分岐 if(x>0){} {x>0 && <Comp/>} {x>0 && <Comp/>} {x>0 && <Comp/>} v-if="x>0"
非同期処理 async function(){} useEffect(()=>{...},[]) getServerSideProps / fetch() useEffect(()=>{...},[]) async setup(){}
HTTPリクエスト fetch(url) fetch(url) fetch(url) / SSR API fetch(url) axios.get(url)
クラス / コンポーネント class Foo{} function Foo(){} function Page(){} function Foo(){} export default {}
状態管理 - useState() / useReducer() useState() / useReducer() useState() / useReducer() ref() / reactive()
ルーティング Express.js / Router react-router-dom pages/ 自動ルーティング react-navigation vue-router
モジュールインポート import {x} from "mod" import {useState} from "react" import Link from "next/link" import {Text} from "react-native" import {ref} from "vue"
イベント処理 element.addEventListener <button onClick={fn}> <button onClick={fn}> <Button onPress={fn}/> @click="fn"

⚡ 非同期処理(APIリクエスト)比較表

言語 / FW 非同期処理の方法 APIリクエスト例
Java CompletableFuture, Executor HttpClient.sendAsync(...)
Python asyncio, aiohttp requests.get(url) / aiohttp
Go go func(){} (goroutine) http.Get(url)
Ruby Thread.new {} Net::HTTP.get(url)
PHP curl_multi_exec, Guzzle file_get_contents(url) / Guzzle
Kotlin coroutines (suspend fun) HttpClient, Ktor
Swift async/await, DispatchQueue URLSession.shared.dataTask
Node.js async/await, Promise fetch(url) / axios.get(url)
TypeScript async/await fetch(url) / axios.get(url)
React useEffect + fetch fetch(url) inside useEffect
Next.js getServerSideProps, fetch fetch(url) (SSR/SSG対応)
ReactNative useEffect + fetch fetch(url)
Vue.js async setup, watchEffect axios.get(url)

📝言語・フレームワーク別 データ取得→結果出力or表示 例

java

qiita.java
import java.net.http.*;
import java.net.URI;
import java.io.IOException;

public class Main {
    public static void main(String[] args) throws IOException, InterruptedException {
        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://jsonplaceholder.typicode.com/todos/1"))
            .build();
        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.body());
    }
}

Python

qiita.py

import requests

res = requests.get("https://jsonplaceholder.typicode.com/todos/1")
print(res.json())

Go

qiita.go
package main
import (
    "fmt"
    "net/http"
    "io/ioutil"
)

func main() {
    resp, _ := http.Get("https://jsonplaceholder.typicode.com/todos/1")
    defer resp.Body.Close()
    body, _ := ioutil.ReadAll(resp.Body)
    fmt.Println(string(body))
}

Ruby

qiita.rb
require 'net/http'
require 'json'

url = URI("https://jsonplaceholder.typicode.com/todos/1")
res = Net::HTTP.get(url)
data = JSON.parse(res)
puts data

PHP

qiita.php
<?php
$response = file_get_contents("https://jsonplaceholder.typicode.com/todos/1");
$data = json_decode($response, true);
print_r($data);

Kotlin

qiita.kt
import java.net.HttpURLConnection
import java.net.URL

fun main() {
    val url = URL("https://jsonplaceholder.typicode.com/todos/1")
    with(url.openConnection() as HttpURLConnection) {
        requestMethod = "GET"
        inputStream.bufferedReader().use {
            val response = it.readText()
            println(response)
        }
    }
}

Swift

qiita.swift
import Foundation

let url = URL(string: "https://jsonplaceholder.typicode.com/todos/1")!

let task = URLSession.shared.dataTask(with: url) { data, response, error in
    if let data = data {
        if let jsonString = String(data: data, encoding: .utf8) {
            print(jsonString)
        }
    }
}
task.resume()

// PlaygroundやCLIで実行する場合はRunLoopを止めないように以下を追加
RunLoop.main.run()

Node.js

qiita.js
const fetch = require("node-fetch");

(async () => {
  const res = await fetch("https://jsonplaceholder.typicode.com/todos/1");
  const data = await res.json();
  console.log(data);
})();

TypeScript

qiita.ts
async function fetchData(): Promise<void> {
  const res = await fetch("https://jsonplaceholder.typicode.com/todos/1");
  const data = await res.json();
  console.log(data);
}

fetchData();

React

qiita.jsx
import { useEffect, useState } from "react";

export default function App() {
  const [todo, setTodo] = useState(null);

  useEffect(() => {
    fetch("https://jsonplaceholder.typicode.com/todos/1")
      .then(res => res.json())
      .then(data => setTodo(data));
  }, []);

  return (
    <div>
      {todo ? <p>{todo.title}</p> : <p>Loading...</p>}
    </div>
  );
}

Next.js

qiita.jsx
export async function getServerSideProps() {
  const res = await fetch("https://jsonplaceholder.typicode.com/todos/1");
  const todo = await res.json();
  return { props: { todo } };
}

export default function Page({ todo }) {
  return <p>{todo.title}</p>;
}

React Native

qiita.jsx
import { useEffect, useState } from "react";
import { Text, View } from "react-native";

export default function App() {
  const [todo, setTodo] = useState(null);

  useEffect(() => {
    fetch("https://jsonplaceholder.typicode.com/todos/1")
      .then(res => res.json())
      .then(data => setTodo(data));
  }, []);

  return (
    <View>
      {todo ? <Text>{todo.title}</Text> : <Text>Loading...</Text>}
    </View>
  );
}

Vue.js

qiita.vue
<template>
  <div>
    <p v-if="todo">{{ todo.title }}</p>
    <p v-else>Loading...</p>
  </div>
</template>

<script setup>
import { ref, onMounted } from "vue"

const todo = ref(null)

onMounted(async () => {
  const res = await fetch("https://jsonplaceholder.typicode.com/todos/1")
  todo.value = await res.json()
})
</script>
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?