Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Java SE 综合讨论区 » 编程/算法/API  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 一道招聘笔试题
zhongbangxing





发贴: 1
积分: 0
于 2007-05-18 15:17 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
编写一段以下面形式输出的代码:
1 A
2 BB
3 CCC
……
25 YYYYYYYYYYYYYYYYYYYYYYYYY
26 ZZZZZZZZZZZZZZZZZZZZZZZZZZ
27 012345678901234567890123456




struts2升级到2.3.15.1总结
作者 Re:一道招聘笔试题 [Re:zhongbangxing]
aaarong





发贴: 24
积分: 0
于 2007-05-18 17:19 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
public class Example{
  public static void main(String[] args){
    char a=65;
    char array[][]=new char[28][28];
    for(int i=1;i<=27;i++){
      System.out.print(i+" ");
      if(i<27){
        for(int j=1;j<=i;j++){
          array[i][j]=a;
          System.out.print(array[i][j]);
        }
      }else{
        if(i==27){  
          a=48;
        }
        for(int p=1;p<=i;p++){
          array[i][p]=a;
          System.out.print(array[i][p]);
          a++;
          if(a>57){
            a=48;  
          }
        }  
        System.out.println();
      }
      System.out.println();
      a++;
      }
  }
}




JSR 371——Java EE 8新的MVC框架
作者 Re:一道招聘笔试题 [Re:zhongbangxing]
xatm092





发贴: 31
积分: 0
于 2007-05-19 13:47 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
我的做法是
(前面略,我想给出主要片段就行了.)
System.out.println("1 A");
System.out.println("2 BB");
...(中间略,我想你明白我的意思了.)
System.out.println("26 ZZZZZZZZZZZZZZZZZZZZZZZZZZ");
System.out.println("27 012345678901234567890123456");




庆祝CJSDN成立10周年
作者 Re:一道招聘笔试题 [Re:zhongbangxing]
informit





发贴: 3
积分: 0
于 2007-05-20 01:16 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
public class Example {

public static void main(String[] args) {
String s;
for(int i=1, char c='A'; i<=26; i++, c++){
s = " ";
for(int j=1; j<=i; j++)
s = s + c;
System.out.println(i + s);
}
System.out.println("27 0123456789101234567890123456");
}
}




庆祝CJSDN成立10周年
作者 Re:一道招聘笔试题 [Re:zhongbangxing]
133xialiang





发贴: 26
积分: 0
于 2007-05-24 09:56 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
public class Text {
  public static void main(String args[]) {

    int x = 0;
    for (char c = 'A'; c <= 'Z'; c++) {
      x++;
      System.out.print(x + " ");
      for (int i = 0; i < x; i++) {
        System.out.print( c );
      }
      System.out.println();
    }
    System.out.print(x + 1 + " ");
    for (int i = 0; i <= x; i++) {

      System.out.print(i % 10);
    }
    

  }
}




JVM参数调优,无停滞实践
作者 Re:一道招聘笔试题 [Re:zhongbangxing]
flying_sun





发贴: 14
积分: 0
于 2007-05-28 15:53 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
import java.io.*;
public class Testprint
{
public static void main(String args[])
{
int i =1;
String str="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
while(i< 27)
{
charprint testp = new charprint(i,str.charAt(i-1));
testp.printchar();
i ++;
}
System.out.println("27012345678901234567890123456");
}
}
class charprint{
int i;
int j;
char str;
charprint(int num,char str1)
{
this.i = 0;
this.j = num;
this.str = str1;
}

public void printchar()
{
System.out.print(j );
while(i<j)
{
System.out.print(this.str);
i ++;
}
System.out.println();
}
}




JSR 371——Java EE 8新的MVC框架
作者 Re:一道招聘笔试题 [Re:zhongbangxing]
Jcat

熊猫的猫



发贴: 266
积分: 16
于 2007-06-01 10:35 user profilesend a private message to usersend email to Jcatsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
支持 133xialiang


编程,游泳,睡觉--SleepingCat

JCheckBox array 问题
作者 Re:一道招聘笔试题 [Re:zhongbangxing]
simleebdg





发贴: 2
积分: 0
于 2007-06-01 11:40 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
当时做出来了,就可以了.呵呵.我也支持133xialiang啊



热烈祝贺CJSDN成立12周年!
作者 Re:一道招聘笔试题 [Re:zhongbangxing]
133xialiang





发贴: 26
积分: 0
于 2007-06-13 15:14 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
我才发了几个贴,我学习java刚一年,还是个新手,有各位的支持,我信心就更大了。



Thymeleaf 1.1.1 发布,基于Java的XML/XHTML/HTML5模板引擎
作者 Re:一道招聘笔试题 [Re:zhongbangxing]
liangzi232004





发贴: 2
积分: 0
于 2007-06-13 18:32 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
4楼方法也行~~



Thymeleaf 1.1.1 发布,基于Java的XML/XHTML/HTML5模板引擎
作者 Re:一道招聘笔试题 [Re:zhongbangxing]
Yang14





发贴: 5
积分: 0
于 2007-07-11 02:55 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
//**打印图1A

public class Print
{
static String[] s={"A","B","C","D","E","F","G",
"H","I","G","K","L","M","N",
"O","P","Q","R","S","T",
"U","V","W","X","Y","Z",
};


  static void go(int i)
  {
    System.out.printLight Bulb;
    for(int m=0;m<i;m++)
    
    System.out.print(s[i-1]);
    System.out.println();
    
  }
  
  
  public static void main(String[] args)
  {
    try
    {
   for(int l=1;l<27;l++)
   {
     go(l);
   }
  
  
  
   for(int x=0;x<27Wink
   {
     for(int y=0;y<10&&x<27;y++,x++)
     {
       
       System.out.printThumbs up;
     }
     
   }
  
   }
   catch(Exception e)
   {
   }
}
}




JVM参数调优,无停滞实践
作者 Re:一道招聘笔试题 [Re:zhongbangxing]
Yang14





发贴: 5
积分: 0
于 2007-07-11 02:56 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
//**打印图1A

public class Print
{
static String[] s={"A","B","C","D","E","F","G",
"H","I","G","K","L","M","N",
"O","P","Q","R","S","T",
"U","V","W","X","Y","Z",
};


  static void go(int i)
  {
    System.out.print(i);
    for(int m=0;m<i;m++)
    
    System.out.print(s[i-1]);
    System.out.println();
    
  }
  
  
  public static void main(String[] args)
  {
    try
    {
   for(int l=1;l<27;l++)
   {
     go(l);
   }
  
  
  
   for(int x=0;x<27;)
   {
     for(int y=0;y<10&&x<27;y++,x++)
     {
       
       System.out.print(y);
     }
     
   }
  
   }
   catch(Exception e)
   {
   }
}
}




国务院第五批行政审批决定 取消BBS专项备案
作者 Re:一道招聘笔试题 [Re:133xialiang]
Yang14





发贴: 5
积分: 0
于 2007-07-11 03:00 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
133xialiang wrote:
public class Text {
  public static void main(String args[]) {

    int x = 0;
    for (char c = 'A'; c <= 'Z'; c++) {
      x++;
      System.out.print(x + " ");
      for (int i = 0; i < x; i++) {
        System.out.print( c );
      }
      System.out.println();
    }
    System.out.print(x + 1 + " ");
    for (int i = 0; i <= x; i++) {

      System.out.print(i % 10);
    }
    

  }
}

高手啊 看看我的真是惭愧




IBM Rational Software Architect V8.5
作者 Re:一道招聘笔试题 [Re:zhongbangxing]
dorrenchen





发贴: 298
积分: 30
于 2007-07-12 23:09 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
尝尝我ruby的厉害。

actual code.
<code>
n = ?A - 1
(1..26).each{|i| puts "#{i} #{(i+n).chr*i} "}
puts "27 " + (0..27).collect{|i| i%10}.to_s
</code>

some ruby explanation.
<code>
# some ruby language functions
#
# ?<X> return the ASCII code of the character
# ?A => 65
# ?B => 66
# ?\n => 10 backspace ASCII code is 10
#
#
# <N>.chr returns the character from given ASCII code
# 65.chr => "A"
# 66.chr => "B"
# 10.chr => "\n"
#
#
# <STR>*<n> multiplies given string n times.
# "ABC"*2 => ABCABC
#
#
# ruby use "#{var}" syntax to print variable in a string
# x = "abc"
# puts "output: #{x}" => "output: abc"
</code>




微信支付demo
作者 Re:一道招聘笔试题 [Re:zhongbangxing]
dorrenchen





发贴: 298
积分: 30
于 2007-07-12 23:13 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
actual code.
 
n = ?A - 1
(1..26).each{|i| puts "#{i} #{(i+n).chr*i} "}
puts "27 " + (0..27).collect{|i| i%10}.to_s


some ruby explanation
 
# ?<X> return the ASCII code of the character
# ?A => 65
# ?B => 66
# ?\n => 10 backspace ASCII code is 10
#
#
# <N>.chr returns the character from given ASCII code
# 65.chr => "A"
# 66.chr => "B"
# 10.chr => "\n"
#
#
# <STR>*<n> multiplies given string n times.
# "ABC"*2 => ABCABC
#
#
# ruby use "#{var}" to print variable in a string
# x = "abc"
# puts "output: #{x}, #{x*2}" => "output: abc"




JSR 371——Java EE 8新的MVC框架
作者 Re:一道招聘笔试题 [Re:zhongbangxing]
wzymiller





发贴: 3
积分: 0
于 2007-07-21 22:30 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
public class Example
{
public static void main(String[] args)
{
char a=65;
char array[][]=new char[26][26];
for(int i=0;i<=26;i++,a++)
{
//System.out.print(i+" ");
if(i<26)
{
for(int j=0;j<=i;j++)
{
array[i][j]=a;
System.out.print(array[i][j]);

}
}else
{

System.out.print("012345678901234567890123456");


}
}


}
}




庆祝CJSDN成立9周年
作者 Re:一道招聘笔试题 [Re:aaarong]
xiaoping8411





发贴: 1
积分: 0
于 2007-09-18 19:27 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
public class PrintNumberLetter{
public static void main(String[] args){
print();
}
public static void print(){
  int n=0;
    char a='A';
    for(int i=1;i<=27;i++){
      if(i<=9)
        System.out.print(i+" ");
      else
        System.out.print(i+" ");
      if(i<27){
        for(int j=1;j<=i;j++){  
          System.out.printAngel;
        }  
      }  
      else{
        for(int k=0;k<27;k++){
          if(n>9) n=0;
          System.out.printThumbs down;  
          n++;          
        }
      }
      System.out.println();
      a++;
    }  
  }
}




庆祝CJSDN成立10周年
作者 Re:一道招聘笔试题 [Re:zhongbangxing]
long_5281





发贴: 5
积分: 0
于 2007-11-08 16:32 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
public static void main(String[] args){
int k = 1; //定义变量用于打印字符A BB CCC.....
int n = 1 ; //定义变量用于打印数字012345678901234567890123456
for(int i=65;i<=90;i++){//i=65表示是字符大写A i=90表示是字符大写Z
byte b = (byte)i;
for(int j=1;j<=k&&k<=26;j++){
System.out.print((char)b);//输出A BB CCC.....
}
k++;
System.out.println();
}
while(n<=3){
for(int j=0;j<=9;j++){
if(n==3&&j>6){
continue ;
}else{
System.out.print(j); //输出012345678901234567890123456
}
}
n++;
}
}




tomcat7引起 Attribute qualified names must be unique
作者 Re:一道招聘笔试题 [Re:zhongbangxing]
weiyidexuan





发贴: 19
积分: 1
于 2007-11-11 01:37 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
//@author ricky
//package com.ricky.www
public class Test{
  public static void print(char c,int times){
    System.out.print(c);
    if(times == 1){
      System.out.println();
    }else{
      print(c,times - 1);
    }
  }

  public static void main(String[] args){
    char i = 0;
    for(i = 'A' ; i <= 'Z' ; i ++){
      int times = i - 'A' + 1;
      System.out.printf("%2d ",times );
      print(i,times);
    }
    int times = i - 'A' + 1;
    System.out.print( times + " ");
    
    for(int j = 0 ; j < times ; j ++){
      System.out.print(j % 10);
    }
  }
}




JCheckBox array 问题
作者 Re:一道招聘笔试题 [Re:zhongbangxing]
pubaolin





发贴: 2
积分: 0
于 2007-11-12 01:11 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
public class Untitled2 {
public static void main(String[] args) {
int cc='A';
int aa='Z';
int i=1;
do{
for(int j=0;j<i;j++){
System.out.print((char)cc);
}
System.out.println("");
i++;
cc++;
}while(cc<=aa);
for(int j=0;j<i;j++){
System.out.print(j%10);

}
}

}




庆祝CJSDN成立9周年
作者 Re:一道招聘笔试题 [Re:zhongbangxing]
chaostring





发贴: 6
积分: 0
于 2007-11-12 18:17 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
133xialiang 写得很不错,我也是初学java,向你学习。 借鉴你的代码,我修改了一小下。不知道哪种写法执行效率更高些,请高人指点一下。

public class Test{
public static void main(String[] args) {
for (char c='A';c<='Z';c++){
for(int i=(int)'A'; i<=(int)c;i++){
System.out.print(c);

}
System.out.println();

}
for (int i=(int)'A'; i<=(int)'Z'+1;i++){
System.out.print((i-(int)'A')%10);
}

}




一个初学java的迷茫者
作者 Re:一道招聘笔试题 [Re:zhongbangxing]
chaostring





发贴: 6
积分: 0
于 2007-11-12 19:03 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
这个应该更合理些,打印函数forprint()可以完成很多其他
用途 并且使得主函数看起来很简洁。

public class Test {

public static void main(String[] args) {
for (char c='A';c<='Z';c++){
forPrint(c,1);
System.out.println();

}
forPrint((char)((int)'Z'+1),2);

}


// 打印函数 forPrint()

public static void forPrint(char n ,int k){
for(char i='A'; i<=n;i++){

if(k==1){
System.out.print(n);
}else if(k==2){
System.out.print((i-'A')%10);
}
}

}


}


chaostring edited on 2007-11-12 19:10


自己设计的一个java小管理程序
作者 Re:一道招聘笔试题 [Re:zhongbangxing]
dnorange





发贴: 1
积分: 0
于 2007-11-13 22:25 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
public class MianShi
{
  public static void main(String[] args)
  {
    ShuChu js=new ShuChu();
    js.xianShi();
  }
}

class ShuChu
{
  int xianShi()
  {
    int i=0,j=0;
    char ch='A';
    for(i=1;i<28;i++)
    {
      for(j=0;j<i;j++)
      {
        if(i==27)
        {
          System.out.print(j%10);
          continue;
        }
        System.out.print(ch);
      }
      System.out.print("\n");
      ch++;
    }
    return 0;
  }
}




JVM参数调优,无停滞实践
作者 Re:一道招聘笔试题 [Re:133xialiang]
newfish





发贴: 3
积分: 0
于 2008-10-06 13:51 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
133xialiang wrote:
我才发了几个贴,我学习java刚一年,还是个新手,有各位的支持,我信心就更大了。

真是惭愧啊,在下做java开发已经快2年了尚不能写出如此精练的代码.




一个初学java的迷茫者
作者 Re:一道招聘笔试题 [Re:aaarong]
yusilong860815





发贴: 6
积分: 0
于 2008-10-06 16:14 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
我也是支持133xialiang


记住该记住的,
忘记该忘记的。
改变能改变的,
接受不能改变的。

cjsdn 成立十年了,大家读来晒晒自己的变化和近况
作者 Re:一道招聘笔试题 [Re:zhongbangxing]
jackieban





发贴: 2
积分: 1
于 2009-04-24 16:26 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
public class ascII{
  public static void main(String args[]){
    for(char i='A'; i<='Z'; i++){
      for(int j=0; j<i-'A'+1; j++){
        System.out.printLight Bulb;  
      }
      System.out.println();
    }  
    for(int i=0; i<=26; i++){
      System.out.print(i%10);
    }
    System.out.println();
  }
}




关于ibm-jdk下的证书加密解密问题
作者 Re:一道招聘笔试题 [Re:zhongbangxing]
楚狂人





发贴: 1
积分: 0
于 2009-05-29 15:48 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
public class T {
  public static void main(String[] args) {
    int count = 0;
    for(int i = (int)'A';i <= (int)'Z';i++ ) {
      ++count;
      System.out.print(count+" ");
      for(int j = 0;j < count;j++) {
        System.out.print((char)i);
      }
      System.out.println("");
    }
    count += 1;
    System.out.print(count+" ");
    for(int i = 0;i < count;i++) {
      System.out.print(i%10);
    }
  }
}
/*
其实前面的输出都很简单,但是不明白最后的一行究竟有什么意图,所以加上去的比较牵强,感觉还是有那么一点点的不爽,呵呵。
*/




一个初学java的迷茫者
作者 Re:我的解法 [Re:zhongbangxing]
bashenxiutian





发贴: 1
积分: 0
于 2009-07-26 13:58 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
public class Test {

  public static void show(int n) {
    // 字母部分
    char element = 'A';
    for (int i = 1; i < n; i++) {
      System.out.print(i + "\t");
      for (int j = 1; j <= i; j++) {
        System.out.print(element);
      }
      element++;
      System.out.println();
    }
    // 数字部分
    System.out.print("27" + "\t");
     for(int i=0; i<=26; i++){
     System.out.print(i%10);
     }
  }

  public static void main(String[] args) {
    show(27);
  }
}





求助:java程序易死机原因
作者 Re:一道招聘笔试题 [Re:133xialiang]
sunny9527





发贴: 4
积分: 0
于 2009-07-30 17:02 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
133xialiang wrote:
public class Text {
  public static void main(String args[]) {

    int x = 0;
    for (char c = 'A'; c <= 'Z'; c++) {
      x++;
      System.out.print(x + " ");
      for (int i = 0; i < x; i++) {
        System.out.print( c );
      }
      System.out.println();
    }
    System.out.print(x + 1 + " ");
    for (int i = 0; i <= x; i++) {

      System.out.print(i % 10);
    }
    

  }
}

精辟




Android M

flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923