Question about Compilers & Programming Tools

1 Answer

Java programming: file access

Specifications:
-a simple java program that asks the user to input a file name
-the program then reads the file
-it outputs how many times capital A's -- 'A' has occurred in the file that the user specified

i would greatly appreciate if anyone would do this tonight for i need this tomorrow..

Posted by on

1 Answer

(R.id.note) this is the error in java, How can I rectify it;

Posted on Sep 03, 2008

Add Your Answer

Uploading: 0%

my-video-file.mp4

Complete. Click "Add" to insert your video. Add

×

Loading...
Loading...

Related Questions:

1 Answer

I am doing research on PC vs Mac for unix programming. What are the differences? Which Platform would be preferred?


That was a rather open question.

As long as the language is standards-based, you should have no problem using the language on any platform where it's certified.

That said, anything related to utilising specific operating-system related features such as GUI are much different, except in Java. Since Java is the same output regardless of platform (but version-specific), you can run it on any platform with the correct version (usually the same or newer) Java Virtual Machine. As mentioned, Java programming is the same on almost any platform. Traditionally, Macs lagged way behind Windows as far as Java releases are concerned, but the lag a lot less now (a few months, sometimes less). Macs also are much more Java-friendly.

Non-Java GUI programming is, as mentioned, much different. Honestly, enough tools exist on both platforms to make GUI programming similar in experience, though much different in actual code.

C, C++ both program the same on either platform (again, GUI code will be platform-specific).

A giant plus to Mac programming is that you have access to all the UNIX-type stuff in a way which is a part of the OS, as opposed to on a PC, where it all needs to be added on. I love the Terminal app on OS X - nothing like it on PCs.

Finally, if you're backed by someone with money, the tools on PCs are a bit better than what OS X has to offer, but not substantially.

May 11, 2011 | InstallShield 10.5 Premier...

1 Answer

I want to format java code and later want to check whether it got formatted, using checkstyle. How can i do that


write a program that get an input size from the user and print the multiplication table with the specified size :
size of the multiplication table 5;
multiplication table of size 5;

Jul 07, 2010 | Sun Java Programming Language (cdj-275)

1 Answer

How to install jdk1.6


download the Java Development Kit for your specific operating system from the sun java website. For windows, the installer will be an executable file so just run it and follow the prompts.

For linux, ubuntu or debian, Download the jdk bin file. Go to your terminal or konsole then set yourself as a super user and run the file by typing ./jdkxxxxxx.bin or whatever your bin file was. For mandriva and red hat, download the .rpm.bin file. run the bin file and it will load the rpm file. Just follow the steps.

For Mac. I think Mac does not support that version yet.

I hope this helps.

May 04, 2010 | Sun Java Programming Language (cdj-275)

2 Answers

Using java code to access a machine's c drive


u can do that using java s file hadnling mechanism.

Oct 30, 2009 | Sun Java Programming Language (cdj-275)

4 Answers

Java is not working


Hello there :
first you are going to want to ensure that your your current version of java is installed correctly and is not corrupted and if it needs to be reinstalled
download the latest java version and reinstall this . www.java.com
this should be able to take care of the problem that you are having ok?
best regards michael

Aug 23, 2009 | ArcMedia JavaScript Source Code 3000 Pro...

1 Answer

I want to read text file which is located in c drive using java code can anybody help me out


import java.io.*;
import java.util.Scanner;

public final class ReadWithScanner { public static void main(String... aArgs) throws FileNotFoundException {
ReadWithScanner parser = new ReadWithScanner("C:\\Temp\\test.txt");
parser.processLineByLine();
log("Done.");
}

/**
* @param aFileName full name of an existing, readable file.
*/

public ReadWithScanner(String aFileName){
fFile = new File(aFileName);
}

/** Template method that calls {@link #processLine(String)}. */
public final void processLineByLine() throws FileNotFoundException {
Scanner scanner = new Scanner(fFile);
try {
//first use a Scanner to get each line
while ( scanner.hasNextLine() ){
processLine( scanner.nextLine() );
}
}
finally {
//ensure the underlying stream is always closed
scanner.close();
}
}

/**
* Overridable method for processing lines in different ways.
*
* <P>This simple default implementation expects simple name-value pairs, separated by an
* '=' sign. Examples of valid input :
* <tt>height = 167cm</tt>
* <tt>mass = 65kg</tt>
* <tt>disposition = "grumpy"</tt>
* <tt>this is the name = this is the value</tt>
*/

protected void processLine(String aLine){
//use a second Scanner to parse the content of each line
Scanner scanner = new Scanner(aLine);
scanner.useDelimiter("=");
if ( scanner.hasNext() ){
String name = scanner.next();
String value = scanner.next();
log("Name is : " + quote(name.trim()) + ", and Value is : " + quote(value.trim()) );
}
else {
log("Empty or invalid line. Unable to process.");
}
//(no need for finally here, since String is source)
scanner.close();
}

// PRIVATE //
private final File fFile;

private static void log(Object aObject){
System.out.println(String.valueOf(aObject));
}

private String quote(String aText){
String QUOTE = "'";
return QUOTE + aText + QUOTE;
}
}

Jun 22, 2009 | Sun Java Programming Language (cdj-275)

4 Answers

Can anyone tell how run java program in cmd prompt???


Hi,

You need to type:

If it's a program.class

java program

or of it's a program.jar

java -jar program.jar

regards

Apr 03, 2009 | Sun Java Programming Language (cdj-275)

2 Answers

Rename a folder in c drive using java code


import java.io.*;

public class RenameFileOrDir{

public static void main(String[] args) throws IOException{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
System.out.print("Please enter the file or directory
name which has to be Renamed : ");

String old_name = in.readLine();
File oldfile = new File(old_name);


if(!oldfile.exists())
{

System.out.println("File or directory does not exist.");

System.exit(0);

}

System.out.print("please enter the new file or directory name : ");

String new_name = in.readLine();

File newfile = new File(new_name);

System.out.println("Old File or directory name : "+ oldfile);
System.out.println("New File or directory name : "+ newfile);
boolean Rename = oldfile.renameTo(newfile);

if(!Rename)
{

System.out.println("File or directory does not rename successfully.");

System.exit(0);

}

else {

System.out.println("File or directory rename is successfully.");

}

}

}

Mar 30, 2009 | Sun Java Programming Language (cdj-275)

3 Answers

Error to compile java program


The main cause of this error is you havent set the environment variables correctly, you can do it as follows

Right click on "My Computers" select properties the click "Environment variables" then under "User variables for pcname"

select new and add the following paths

1)var name:path
var value:C:\Java\jdk1.5\bin

2)var name:classpath
var value:C:\YourJavaCodeDirName

click ok and its done

Feb 28, 2009 | Sun Java Programming Language (cdj-275)

1 Answer

JSP: Java code doesn't go steady with the HTML code,no output seen!!


<html>
<body>
<form name=form1 action=test.jsp method=Get>
name:<input type="text" name="user">
<input type="submit">
</form>
<%=request.getParameter("user")%>
</body>
</html>

Feb 22, 2008 | Compilers & Programming Tools

Not finding what you are looking for?
Compilers & Programming Tools Logo

Related Topics:

84 people viewed this question

Ask a Question

Usually answered in minutes!

Top Compilers & Programming Tools Experts

Robin Hill
Robin Hill

Level 3 Expert

1251 Answers

Fred Block
Fred Block

Level 2 Expert

289 Answers

Les Dickinson
Les Dickinson

Level 3 Expert

18304 Answers

Are you a Compiler and Programming Tool Expert? Answer questions, earn points and help others

Answer questions

Manuals & User Guides

Loading...