JAVA string 练习

作者在 2016-12-04 10:43:48 发布以下内容
package Fuck;

public class Suan 
{
	public static void main(String[] args)
		{
//			Ford();
			Lexus();
		}
	public static void Ford()
		{
			int math =53;
			int english = 67;
			if (math > 60)
				{
					System.out.println("ok");
				}
			else
				{
					System.out.println("error");
				}
			if (english >70)
				{
					System.out.println("english good");
				}
			else
				{
					System.out.println("english bad");
				}
			int x = 20;
			if (x > 30)
				{
					System.out.println("over 30");
				}
			else if ( x >0)
				{
					System.out.println("over 10 lower 30");
				}
			else if (x > 10)
				{
					System.out.println("over 0 lower 10");
				}
			else
				{
					System.out.println("a = 0");
				}
			int week = 2;
			switch (week)
				{
					case 1:
						System.out.println("monday");
						break;
					case 2:
						System.out.println("tuesday");
						break;
					case 3:
						System.out.println("wednesday");
						break;
					default:
						System.out.println("sorry,fuck u");
				}
			int x = 1;
			int sum =0;
			while(x<=10)
				{
					sum = sum + x;
					x++;
				}
			System.out.println(x++);
			int a = 100;
			while (a<100)
				{
					System.out.println("ok1");
					a--;
				}
			int b = 100;
			do
				{
					System.out.println("ok2");
					b--;
				}
			while (b == 60);
				{
					System.out.println("over");
				}
			int sum = 0;
			for (int i = 2; i <100; i+=2)
				{
					sum = sum + i;
				}
			System.out.println(sum);
			int arr[] = {3,5,6};
			System.out.println("array element:");
			for (int x :arr)
				{
					System.out.println(x);
				}

	public static void Lexus()
		{
			/*String s1 = new String("hello ");
			String s2 = new String("fuck");
			String s = s1+ ""+ s2;
			System.out.println(s);
			int booktime =4;
			float practice = 2.5f;
			System.out.println("everyday"+ booktime + practice + "lianxi");
			System.out.println("everyday" +booktime +"see boook"+(practice+booktime)+"hours train");
			*/
			String s = "wewanttofuckyou";
			
//			int size = s.length();
//			int size = s.indexOf("a");//3
//			int size = s.lastIndexOf("a");//3
			int size = s.charAt(5);
			System.out.println(size);
			
		}
		
}

JAVA | 阅读 1777 次
文章评论,共0条
游客请输入验证码
浏览2354323次