3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Javaプログラミングの全て

Last updated at Posted at 2020-05-15

1.Javaプログラミングの全て

superHello.HelloJava.java
/** @author Ryome */
/** Javaプログラミングの全て(カプセル化・継承・ポリモーフィズム・インターフェース・オーバーロード・オーバーライド・
 *  List・try-catch・例外・Javadoc)*/
package superHello;

import java.util.Arrays;
class HelloException extends Exception{private static final long serialVersionUID=1L;HelloException(String m){super(m);}}
interface SuperHelloWorld {public abstract String SuperHello() throws HelloException;}
abstract class Hello implements SuperHelloWorld{final String HELLO="Helloworld";private String hello;
Hello(){this.hello=HELLO;}Hello(String hello){this.hello=hello;}public abstract String SuperHello() throws HelloException;
public String getHello(){return hello;}}
class HelloWorld extends Hello {HelloWorld(){super();}@Override public String SuperHello() throws HelloException{return getHello();}}
public class HelloJava{
    /** mainメソッド @param args 使用しない */
	public static void main(String[] args){
		try {Arrays.asList(new HelloWorld().SuperHello()).forEach(System.out::println);}catch(HelloException e){}finally{}
	}
}
  • 上記の文をコピーして、文字コードは S-JIS を指定し、フォルダ名を superHello ファイル名を HelloJava.java で保存し、実行するとこうなります。↓↓      
    Javaの全ての結果.png

2.GitHub

GitHubにソースコードを公開しています。

3.関連

3
1
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
3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?