Week #8 Challenge: Java

  • (6 Pages)
  • +
  • 1
  • 2
  • 3
  • Last »

77 Replies - 15930 Views - Last Post: 18 October 2011 - 12:42 PM

#1 skyhawk133  Icon User is offline

  • Head DIC Head
  • member icon

Reputation: 1876
  • View blog
  • Posts: 20,284
  • Joined: 17-March 01

Week #8 Challenge: Java

Post icon  Posted 22 February 2010 - 11:06 AM

*
POPULAR

Posted Image Week #8: Java

Posted Image

CHALLENGE:
Experience the Java programming language. For those of you C++ or .Net programmers out there, here's your chance to see what all Java fanatics love about Java :)

INTRODUCE THE LANGUAGE/TECHNOLOGY:
Java was a revolutionary language when it was first created that was modelled from C++. The idea was that you could run a Java program on any computer system that supported the Java Virtual Machine (JVM). The first implementation wasn't very well received and there were many jokes about the "write it once" philosophy. The second release of Java solved all of the problems and Java has become a powerful, popular, high level programming language. Because of the JVM, Java runs on almost any system. You can not only create desktop programs with Java, you can create web applications as well. Java also has its own GUI toolkit called Swing that is used to create familiar windowed applications like web browsers. integrated development environments, and more. What made Java revolutionary was that it was compiled into bytecode. The JVM would then read the bytecode to have the program execute. Unlike traditional interpretters, the bytecode allowed programs to execute faster.

IDEAS:
  • Command-Line Calculator
  • GUI Calculator
  • Applets!
  • Notepad
  • Games, using Swing
  • HTML WYSIWIG editor Advanced
  • Create an appointment book that uses a database Advanced


RESOURCES:
Official Sun website download
Official tutorial
Dream.In.Code tutorials
Dream.In.Code snippets

HOW TO GET STARTED:
This is the best startup guide I think I've ever read:
http://java.sun.com/...rted/index.html

All that you need is a text editor and the Java JDK. You can download the Java JDK from this link. You do not have to use a text editor. You can also use an integrated development environment(IDE) instead. With the IDE you will still need the Java JDK. Popular IDEs for Java are Net Beans, Eclipse, and JCreator.

Java is a completely Object-Oriented language. That means that everything and everything is a class and composed of objects. Here is the traditional "Hello World" program written in Java. When learning a new language the majority of people will write a program that will print "Hello World" on the screen. You should note that the name of the class your main method is in needs to have the same file name as the name of the class. In the example below, when you save your program, it must be named Hello.java for the program to work.


class Hello {
    public static void main(String[] args) {
        System.out.println("Hello World");
    }
}



WHERE TO GO FOR HELP:
If you are in need of help with you Java programs, you can visit the Java forum here on DIC. The java code snippets and java tutorials will help you in your challenge as well. The best resource for beginning with Java are the Java Tutorials from Sun.

Is This A Good Question/Topic? 7
  • +

Replies To: Week #8 Challenge: Java

#2 Raynes  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 611
  • View blog
  • Posts: 2,815
  • Joined: 05-January 09

Re: Week #8 Challenge: Java

Posted 22 February 2010 - 11:13 AM

I'm going to do this one for sure. Trying to find some motivation, but Java has never really been my thing. Maybe I can polyglot with Java and Clojure and/or Ioke and make it really fun! :D

EDIT: Changed my comment, because I believe the original intent was misunderstood (refer to down-votes).

This post has been edited by Raynes: 25 February 2010 - 11:15 AM

Was This Post Helpful? 0
  • +
  • -

#3 Nykc  Icon User is offline

  • Gentleman of Leisure
  • member icon

Reputation: 729
  • View blog
  • Posts: 8,642
  • Joined: 14-September 07

Re: Week #8 Challenge: Java

Posted 22 February 2010 - 11:22 AM

I can probably squeeze this one in and refine my skills in Java. :)
Was This Post Helpful? 0
  • +
  • -

#4 m-e-g-a-z  Icon User is offline

  • Winning
  • member icon


Reputation: 496
  • View blog
  • Posts: 1,453
  • Joined: 19-October 09

Re: Week #8 Challenge: Java

Posted 22 February 2010 - 11:56 AM

Hmm i was waiting when java would pop up :)..i will prob get something done one afternoon im free this week.

Edit : marked down for this post? Strange

This post has been edited by m-e-g-a-z: 25 February 2010 - 11:43 AM

Was This Post Helpful? 2
  • +
  • -

#5 SwiftStriker00  Icon User is offline

  • No idea why my code works
  • member icon

Reputation: 433
  • View blog
  • Posts: 1,596
  • Joined: 25-December 08

Re: Week #8 Challenge: Java

Posted 22 February 2010 - 11:59 AM

public class Awesome{
 public static void main( String[] args ){
     System.out.println( "I'm awesome");
 }
}



Dont get too jealous.

But I guess I'll submit this Mp3 renamer, if i have time I'll keep updating it
http://www.cs.rit.ed...3%20Renamer.zip

This post has been edited by SwiftStriker00: 22 February 2010 - 12:00 PM

Was This Post Helpful? 2
  • +
  • -

#6 marmoor1989  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 28-August 09

Re: Week #8 Challenge: Java

Posted 22 February 2010 - 01:46 PM

Nice Java tutorial
http://www.homeandle.../java/java.html
Was This Post Helpful? 0
  • +
  • -

#7 sensui  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 30
  • View blog
  • Posts: 146
  • Joined: 24-August 08

Re: Week #8 Challenge: Java

Posted 22 February 2010 - 01:57 PM

I created a TriangleCalculator where you can enter triangles (side lengths and/or angles) and you'll get the picture of the triangle and various information about it.

You can check it on sourceforge.net (for source code) or softpedia for some screenshots.
Was This Post Helpful? 0
  • +
  • -

#8 programble  Icon User is offline

  • (cons :dic :head)

Reputation: 49
  • View blog
  • Posts: 1,315
  • Joined: 21-February 09

Re: Week #8 Challenge: Java

Posted 22 February 2010 - 02:32 PM

I tried Java a while ago and wrote a basic PONG clone in it :)

There is no AI, so you must play 2 players. Player 1 can control the paddle using W/S and player 2 using the arrow keys. The game can be paused using the P key.

It can be played as an applet at http://programble.co.cc/pong/ and the JAR can be downloaded at http://programble.co.cc/pong/pong.jar (source included)
Was This Post Helpful? 0
  • +
  • -

#9 SixOfEleven  Icon User is offline

  • using Caffeine;
  • member icon

Reputation: 945
  • View blog
  • Posts: 6,342
  • Joined: 18-October 08

Re: Week #8 Challenge: Java

Posted 22 February 2010 - 03:00 PM

I have always wanted to try and write a game with Java. This is the perfect excuse reason to give it a try. Hope to be able to finish this with my now busy life.
Was This Post Helpful? 0
  • +
  • -

#10 Dogstopper  Icon User is offline

  • The Ninjaducky
  • member icon



Reputation: 2874
  • View blog
  • Posts: 11,032
  • Joined: 15-July 08

Re: Week #8 Challenge: Java

Posted 22 February 2010 - 04:12 PM

I write all my games in Java, and currently am still working on one. However, I have the same game in both Applet and full-screen mode. Both are on a "special" part of my website.

The Applet
The most awesome full-screen game that you will ever play.

Just kidding...but it is cool. I'm going over all of these fundamental parts of Java in my blog (as soon as they begin working again) EDIT: IT WORKS!

Edit2: Thanks Erik.Price

This post has been edited by Dogstopper: 22 February 2010 - 07:33 PM

Was This Post Helpful? 3
  • +
  • -

#11 erik.price  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 485
  • View blog
  • Posts: 2,690
  • Joined: 18-December 08

Re: Week #8 Challenge: Java

Posted 22 February 2010 - 05:34 PM

View PostDogstopper, on 22 February 2010 - 05:12 PM, said:



Did you mean http://thousandcodes...ooterV1.0.1.jar ?
Was This Post Helpful? 1
  • +
  • -

#12 njovin  Icon User is offline

  • New D.I.C Head

Reputation: 3
  • View blog
  • Posts: 6
  • Joined: 31-January 10

Re: Week #8 Challenge: Java

Posted 22 February 2010 - 05:38 PM

Taking a java class my first semester of college almost made me quit wanting to code...forever. I never went back to it and never missed it. I'm sure it's a nice language and all, but I'll never use it, ever (except for this challenge).

import java.util.*;
import java.io.*;
class javaIsNotFun {
    public static void main(String[] args) {
		Random generator = new Random();
		String[] langs = {"C","C++","PHP","ASP","C+","VBSCRIPT","PYTHON","COBAL","BASIC"};
		int rand = generator.nextInt(langs.length);
		System.out.println("I'd rather be coding " + langs[rand] + " than Java." ); 
		System.out.print("Press j if you want to know what else.");
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String answer = null;
		boolean allofem = false;
		try {
			answer = br.readLine();
		} catch (IOException e) {
			System.out.println("Error!");
			System.exit(1);
		}
		int x = rand + 1;
		while (answer.equals("j")) {
			System.out.println("\n\nI'd rather be coding " + langs[x] + " than Java." ); 
			x = x + 1;
			if (x >= langs.length) {
				x = 0;
			}
			System.out.print("Press j if you want to know what else. ");
			br = new BufferedReader(new InputStreamReader(System.in));
			try {
				answer = br.readLine();
			} catch (IOException e) {
				System.out.println("Error!");
				System.exit(1);
			}			
			if (x == rand) {
				answer = "";
				System.out.println("\n\nI'd rather be coding \nANYTHING\nthan Java." ); 
				allofem = true;
			}
		} 
		if (allofem == true) {
			System.out.println("\n\nThanks for your time.");
		} else {
			System.out.println("\n\nFine then.  \nBe that way.\n\nJerk.");
		}
	}
}


Was This Post Helpful? 2
  • +
  • -

#13 LetMeFinclOut  Icon User is offline

  • D.I.C Head

Reputation: 11
  • View blog
  • Posts: 115
  • Joined: 14-May 09

Re: Week #8 Challenge: Java

Posted 22 February 2010 - 07:13 PM

I've also never been a fan of Java (though strangely enough, I've taken a liking to C#). But VBScript!? ...Cobal!? ...BASIC!?!?
Was This Post Helpful? -6
  • +
  • -

#14 Raynes  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 611
  • View blog
  • Posts: 2,815
  • Joined: 05-January 09

Re: Week #8 Challenge: Java

Posted 22 February 2010 - 07:36 PM

C# and Java are similar, but the last time I checked, C# offers quite a bit more than Java does at this point. I don't doubt that you like it more. I'm not a big fan of Java either, but I'm definitely a big fan of the JVM and the other languages it hosts.
Was This Post Helpful? 0
  • +
  • -

#15 Java Student  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 21
  • View blog
  • Posts: 481
  • Joined: 05-February 10

Re: Week #8 Challenge: Java

Posted 22 February 2010 - 07:48 PM

View PostDogstopper, on 22 February 2010 - 03:12 PM, said:

I write all my games in Java, and currently am still working on one. However, I have the same game in both Applet and full-screen mode. Both are on a "special" part of my website.

The Applet
The most awesome full-screen game that you will ever play.

I like that game it gives me a few ideas for games i could make in future months.

Also i have ordered a Java book for OOP off of eBay, so we'll see how that turns out. Will be arriving between 22/2/10 - 2/3/10

This post has been edited by Java Student: 22 February 2010 - 08:55 PM

Was This Post Helpful? 0
  • +
  • -

  • (6 Pages)
  • +
  • 1
  • 2
  • 3
  • Last »