java在线教程源码(java 求源代码)
本文目录
java 求源代码
import *****;
public class Demo {
public static void main(String args) {
*****("开始答题");
Scanner scan=new Scanner(*****);
int score=0;
for (int i = 0; i 《 10; i++) {
int a = (int) (*****() * 9 + 1);
int b = (int) (*****() * 9 + 1);
int sum=a+b;
*****(a+"+"+b+"=");
int c=*****();
if(c==sum){
*****("正确\n");
score+=10;
}else{
*****("错误\t正确答案为:"+sum);
}
}
*****("总分:"+score);
*****();
}
}
我想看一点简单的Java程序的源代码
兄弟可以联系 hi留言也行
我这里保留了,从学习java第一天起到现在 学习练习代码,
基础部分注释很详细。
//每一位相加求和
public class Demo
{
public static void main(String args)
{
int i = 45678;
int sum = 0;
int c = 0;
for(int j = 4; j 》= 0; j--)
{
int b = (int) *****(10, j);
c = i / b;
*****(c);
sum += c;
*****("sum=" + sum);
i %= b;
}
*****(sum);
}
}
public class ZY1030
{
public static void main(String asgs)
{
zy1();
zy2();
zy3();
zy4();
zy5();
zy6();
zy7();
yanghuisanjiao();
}
public static void yanghuisanjiao()
{
int;
for(int i = 0; i 《 *****; i++)
{
pas;
pas = 1;
pas = 1;
for(int j = 0; j 《 ***** - 1; j++)
{
if(j 》= 1 && i 》 1)
pas;
}
}
for(int i = 0; i 《 *****; i++)
{
for(int j = 0; j 《 *****; j++)
{
*****(pas);
*****();
}
}
*****();
}
private static void zy1()
{
*****("��ҵ1");
/*
*
**
***
****
*****
******
*******
*/
for(int r = 0; r 《 7; r++)
{
for(int j = 0; j 《 r + 1; j++)
{
*****("*");
}
*****();
}
}
private static void zy2()
{
*****("\n��ҵ2");
/*
*
***
*****
*******
*********
*/
for(int r = 0; r 《= 5; r++)
{
for(int j = 0; j 《 11 - r; j++)
{
*****(" ");
}
for(int j = 0; j 《 r * 2 + 1; j++)
{
*****("*");
}
*****();
}
}
private static void zy3()
{
*****("\n��ҵ3");
/*
*
* *
* * *
* * * *
* * * * *
*/
for(int r = 0; r 《= 5; r++)
{
for(int j = 0; j 《 10 - r; j++)
{
*****(" ");
}
for(int j = 0; j 《 r; j++)
{
*****("* ");
}
*****();
}
}
private static void zy4()
{
*****("\n��ҵ4");
/*
***********
***********
***********
***********
***********
*/
for(int r = 0; r 《= 5; r++)
{
for(int j = 0; j 《 7 - r; j++)
{
*****(" ");
}
for(int j = 0; j 《 10; j++)
{
*****("*");
}
*****();
}
}
private static void zy5()
{
*****("\n��ҵ5");
/*
1X1=1
1X2=2 2X2=4
1X3=3 2X3=6 3X3=9
....
*/
for(int r = 1; r 《= 9; r++)
{
for(int j = 1; j 《= r; j++)
{
int iValue = j * r; //����ֵ
String str = j + "X" + r + "=" + iValue + " ";
*****(str);
//*****(" J:" + j);
}
*****();
//*****("R:" + r);
}
}
private static void zy6()
{
*****("\n��ҵ6");
/*
������(����) ֻ�ܱ�1�ͱ����������������
3 5 7 11 13 17 19 23 ....
int n = 4;
boolean t = true; // assume is SU_SHU
for(int i=2; i《n; i++)
{
if(n%i==0)
{
t = false;
break;
}
}
*****(t);
*/
for(int i = 2; i 《= 100; i++)
{
// if(i % 2 ==0 || i % 3 == 0 )
// {
// continue;
// }
// *****(i + " ");
boolean bTrue = true;
for(int j = 2; j 《 i; j++)
{
if(i % j == 0)
{
bTrue = false;
break;
}
}
if(bTrue)
{
*****(i);
}
}
*****();
}
private static void zy7()
{
*****("\n��ҵ7");
/*
int n = 23623;
int x = n % 100000 / 10000;
*****(x);
x = n % 10000 / 1000;
*****(x);
x = n % 1000 / 100;
*****(x);
*/
}
}
求J**A入门小程序源代码
mport *****.*;
public class HuiWen
{
public static void main(String args)
{
Scanner in=new Scanner(*****);
*****("please input a String:");
String st=*****();
String s=*****();
int i=0;
int j=*****()-1;
boolean t=true;
char first=*****(i);
char last=*****(j);
for(;i《j;)
{
while(!(first》=’a’&&first《=’z’))
{
i++;
first=*****(i);
}
while(!(last》=’a’&&last《=’z’))
{
j--;
last=*****(i);
}
if(i》=j)
break;
if(first==last)
{
i++;
j--;
first=*****(i);
last=*****(j);
}
else
{
t=false;
break;
}
}
if(t)
*****(st+"是回文串");
else
*****(st+"不是回文串");
}
}
//判断是否为回文字串
一个J**A程序,希望高手可以给出源代码,我交作业用,不会做,非常感谢
import *****.*;
public class Date
{
public static int getDays(int year,int moon){
if(moon==2){
if((year%400==0 ) || (year%4==0 && year%100==0) ) return 29;
else return 28;
}
else{
if(moon==1 || moon==3 || moon==5 || moon==7 || moon==8 || moon==10 || moon==12) return 31;
else return 30;
}
}
public static void main(String str){
Scanner sc=new Scanner(*****);
*****("请输出年份:");
int year=*****();
*****("请输出月份:");
int month=*****();
*****(year+"年"+month+"月"+"共有"+getDays(year,month)+"天");
}
}
更多文章:
float down是什么意思(float with 是什么意思)
2026年4月25日 12:00
verilog如何用fwrite(怎么使用fwrite将数据替换为空字符)
2026年4月25日 11:20
perl哈希(perl中怎样把正则表达式匹配的内容存入哈希)
2026年4月25日 11:00
python 连接数据库(使用python连接数据库并修改数据表中数据,有什么不同)
2026年4月25日 10:40
logcat怎么看错误(android开发中logcat怎么查看错误)
2026年4月25日 10:20
文思海辉 php面试题(我想去北京文思海辉实习,刚接到他的电话面试问的问题我都不会,可是为什么还让我过了呢)
2026年4月25日 09:40





