我的编码输入是什么。它有错误吗? [英] What is the input of my coding. Do it have an error?

查看:85
本文介绍了我的编码输入是什么。它有错误吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道这个编码的输入。你可以帮帮我吗?



我尝试了什么:



< pre lang =C#> public class 形状{
int x = 0 ;
public void draw(){
System。 out .println( 绘制形状); }
public void displayX(){
System。 .println(X); }
public class Circle extends Shape {
int x = 1 ;
public void draw(){
System。 out .println( 画一个圆圈); }
public void displayX(){
System。 .println(X); }
public class 测试{
public static void main( String [] args){
Shape shape = new Circle();
shape.draw();
shape.displayX(); }

解决方案

你写的:我们没有。

这意味着你有一个想法代码的意图是什么,而我们根本不知道。

更糟糕的是,我们根本不知道你的输入应该是什么 - 代码不会与用户交互任何方式除了输出几个占位符文本描述已经执行了哪些方法,没有做任何其他事情。



我建议你从开始相当仔细地阅读你的作业问题 - 它可能会保留你需要的信息,但我们也看不到 - 然后执行你的代码......


i dont know the input of this coding. can you help me?

What I have tried:

public class Shape {  
	int x = 0; 
    public void draw() {      
    	System.out.println("Draw a shape");    } 
    public void displayX() {      
    	System.out.println(x);    } } 
 public class Circle extends Shape {   
 	int x = 1; 
    public void draw() {      
    	System.out.println("Draw a circle");    } 
    public void displayX() {      
    	System.out.println(x);    } } 
 public class Test {   
 	public static void main(String[] args) {     
 		Shape shape = new Circle();     
 		shape.draw();       
 		shape.displayX();    } }

解决方案

You wrote it: we didn't.
Which means that you have an idea what the code is meant to do, while we have no idea at all.
Even worse, we have no idea at all what your "inputs" should be - that code does not interact with the user in any way other than to output a couple of "place holder" text descriptions of which methods have been executed, without doing anything else.

I'd suggest you start by reading your homework question rather carefully - it's probably going to hold the info you need but we can't see that either - and then execute your code...


这篇关于我的编码输入是什么。它有错误吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆