首页 > 数学 > 经验 > JAVA课程设计题目,求解几道JAVA程序设计题目

JAVA课程设计题目,求解几道JAVA程序设计题目

来源:整理 时间:2023-10-25 03:09:09 编辑:挖葱教案 手机版

本文目录一览

1,求解几道JAVA程序设计题目

1、单 多 2、this 3、toString() 4、public abstract 6、构造方法 1、10 5 9 10 2、10 3、踢足球! 4、(这题我也不知道答案了)

求解几道JAVA程序设计题目

2,java课程设计题

这估计不是一时半刻的课程,你们老师也真够狠的,不过我可以提供思路给你,你也可以找你们那些会做的同学一起讨论!1、自动侦测局域网内部的用户可以这样子做,根据本机在局域网内的IP段,试图去socket每个IP的固定端口,每个软件都设置一个Seversocket用循环一直等待着access。2、私聊和群聊是统一的,只需通过在发送时判断发一还是发多的问题。3、文件的传送也是简单,只需在两端用相同的读写方式既可,我认为不妨就用二进制输入输出流。4、界面的话是个苦力活,你可以模仿QQ的界面,把QQ秀的地方变成用户列表,其他可以保持不变!
这种问题嘛,你还是自己解决比较好!我向你推荐一些java项目开发视频教程吧: <a href="http://wenwen.soso.com/z/urlalertpage.e?sp=shttp%3a%2f%2fwww.verycd.com%2ftopics%2f2816327%2f" target="_blank">http://www.verycd.com/topics/2816327/</a> 自己可以下载了看看!

java课程设计题

3,JAVA题目

package Jan; public class Test { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub String s = "112211 "; for (int i =0; i <=s.length()/2;i++){ String s1 = " "+s.charAt(i); String s2 = " "+s.charAt(s.length()-i-1); //System.out.println(s.charAt(i)); if(!s1.equals(s2)){ System.out.println( "not "); break; } } System.out.println( "yes "); } }
就三位数啊?哈哈 public boolean isS(int num){ if(num<100||num>999){ return false; }else{ int first = num/100; int three = num%10; if(first==three)return true; } }

JAVA题目

4,JAVA编程类题目

abstract class Shape public abstract int getArea(); public abstract int getLength();}class Rectanger extends Shape private int width; private int length; public Rectanger(int width, int length) this.width = width; this.length = length; } @Override public int getArea() return width * length; } @Override public int getLength() return (width + length) * 2; }}public class App8 public static void main(String[] args) Rectanger rect = new Rectanger(4, 3); System.out.println("area: " + rect.getArea()); System.out.println("length: " + rect.getLength()); }}
我手里刚好有前两天写好的,但替换成的词不大一样,lz自己换下吧 public class flp public static void main( string args[] ) int i; for( i=1; i<=100; i++ ) if( ( i % 3 != 0 ) && ( i % 5 != 0 ) ) system.out.printf( "%8d", i ); else if( i % 3 == 0 ) system.out.print( ( ( i % 5 != 0 ) ? " flip" : "flip" ) ); if( i % 5 == 0 ) if( i % 3 != 0 ) system.out.print( " " ); system.out.print( "flop" ); } } } } 以下是运行时的截图,应该和lz的要求一样吧?

5,JAVA题目

第一个问题radioNameList[i].isSelected()第二题getSource()append第三题 Font fn = new Font("Courier", Font.BOLD, 18); g.setFont(fn);第四题 FileInputStream fis = new FileInputStream("aaa"); FileInputStream fis1 = new FileInputStream(new File("aaa"));FileOutputStream fos = new FileOutputStream("aaaa"); FileOutputStream fos1 = new FileOutputStream("aaaa", true);
teacher.class public class teacher private string name; private int age; private boolean sex; private string major; teacher(string name,int age,boolean sex,string major) this.name=name; this.age=age; this.sex=sex; this.major=major; } public string getname() return name; } public void setname(string name) this.name = name; } public int getage() return age; } public void setage(int age) this.age = age; } public string issex() if(sex) return "男"; }else return "女"; } } public void setsex(boolean sex) this.sex = sex; } public string getmajor() return major; } public void setmajor(string major) this.major = major; }}

6,java 题目

/** * 运行时带上参数,不限个数 */ public class Text2 { public static void main(String[] args) { int i[] = new int[args.length]; // 分别给数组内的int赋值 for(int j = 0; j0; j--) { for (int k = 0; k < j-1; k++) { if (i[k] > i[k+1]){ int temp = i[k]; i[k] = i[k+1]; i[k+1] = temp; } } } return i; } }
排序的方法很多种,学java开始的时候就是学的这些吧,看来你没有好好学哦.
import java.util.Scanner; public class Test1 { public static void main(String[] args) { System.out.print("请输入三个数字: "); Scanner scanner = new Scanner(System.in); //这里定输入的个数 int i[] = new int[3]; // 分别给数组内的int赋值 for (int j = 0; j < i.length; j++) { i[j] = scanner.nextInt(); } // 调用排序的方法 taxis(i); for (int j = 0; j < i.length; j++) { System.out.print(i[j] + " "); } } // 将数组进行冒泡排序后返回 public static int[] taxis(int[] i) { for (int j = i.length; j > 0; j--) { for (int k = 0; k < j - 1; k++) { if (i[k] > i[k + 1]) { int temp = i[k]; i[k] = i[k + 1]; i[k + 1] = temp; } } } return i; } }
最基本的思路就是这样的吧、 private void paixun(int x,int y,int z){ int[] temp=new int[]{x,y,z}; int k; k=temp[0]"+temp[k]); System.out.print(","+(temp[(k+1)%3]

7,JAVA设计题急求重谢

public class Answer1 public static void main(String[] args) int i=0; while(i<5) System.out.println("您好!"); i++; } }}public class Student private String no; private String name; private int age; public String getNo() return no; } public void setNo(String no) this.no = no; } public String getName() return name; } public void setName(String name) this.name = name; } public int getAge() return age; } public void setAge(int age) if (age < 3 || age > 100) this.age = 3; } else this.age = age; } } @Override public String toString() return no + ", " + name + ", " + age; } public Student() super(); } public Student(String no, String name, int age) super(); this.no = no; this.name = name; setAge(age); }}public class StudentTest public static void main(String[] args) Student stu1 = new Student(); stu1.setNo("201901010102"); stu1.setName("关晓彤"); stu1.setAge(22); System.out.println(stu1.toString()); Student stu2 = new Student("201901010101", "鹿晗", 18); System.out.println(stu2.toString()); }}
很想帮你、但图打开一块黑。
今天有空,撸一把看看还记得多少...Q1:public class Answer1 public static void main(String[] main) for (int i=0;i<=5;i++) System.out.println("您好!"); } }}Q2:public class Student private String no; private String name; private int age; public void setNo(String no) this.no = no; } public void setName(String name) this.name = name; } public void setAge(int age) if(age<3 || age >100) System.out.println("年龄应该在3到100岁之间!"); }else this.age = age; } } public String getNo() return no; } public String getName() return name; } public int getAge() return age; } //override public String toString() return no + " , " + name + " , " + age; } public Student() } public Student(String no, String name, int age) this.no = no; this.name = name; this.age = age; } //public static void main(String[] args) // Student stu = new Student("2019010101","鹿晗",18); // System.out.println(stu.toString()); //}}Q3:public class StudentTest public static void main(String[] args) Student stu1 = new Student(); stu1.setNo("2019020202"); stu1.setName("张三"); stu1.setAge(18); System.out.println(stu1.toString()); Student stu2 = new Student("2019030303","李四",19); System.out.println(stu2.toString()); }}Q4:import java.sql.DriverManager;import java.sql.Connection;import java.sql.Statement;import java.sql.ResultSet;public class StudentDAO public static void main(String[] args) throws Exception String url = "jdbc:mysql://localhost:3306/exam?characterEncoding=utf8"; String username = "root"; String password = "123456"; Class.forName("com.mysql.jdbc.Driver"); Connection conn = DriverManager.getConnection(url,username,password); Statement st = conn.createStatement(); String sql = "select * from student"; ResultSet rs = st.executeQuery(sql); while(rs.next()) System.out.println("学号:" + rs.getObject("id")); System.out.println("姓名:" + rs.getObject("name")); System.out.println("年龄:" + rs.getObject("age")); } rs.close(); st.close(); conn.close(); }}
文章TAG:java课程课程设计设计JAVA课程设计题目

最近更新

相关文章