Click here to Skip to main content
15,792,461 members
Home / Discussions / Java
   

Java

 
QuestionWhat should I I learn with Java? Pin
Member 1509539610-Mar-21 4:02
Member 1509539610-Mar-21 4:02 
AnswerRe: What should I I learn with Java? Pin
NotTodayYo10-Mar-21 4:40
NotTodayYo10-Mar-21 4:40 
AnswerRe: What should I I learn with Java? Pin
Richard MacCutchan10-Mar-21 5:06
mveRichard MacCutchan10-Mar-21 5:06 
QuestionPass variable to HttpURLConnection Pin
xoduhuko10-Mar-21 3:40
xoduhuko10-Mar-21 3:40 
QuestionHow to compare two similar xml documents ignoring node text values by using XMLUnit? Pin
mr.pakapun1-Mar-21 18:32
mr.pakapun1-Mar-21 18:32 
SuggestionRe: How to compare two similar xml documents ignoring node text values by using XMLUnit? Pin
Richard MacCutchan1-Mar-21 22:22
mveRichard MacCutchan1-Mar-21 22:22 
QuestionLicense key generator Pin
keznet lisimati27-Feb-21 1:27
keznet lisimati27-Feb-21 1:27 
QuestionDefault My program does not find the file MyFriends.txt Pin
zorapulo11-Feb-21 17:25
zorapulo11-Feb-21 17:25 
Java
import java.util.Scanner;   // Needed for Scanner class
import java.io.*;           // Needed for File class
 
/**
   This program reads the first line from a file.
*/
 
public class ReadFirstLine
{
   public static void main(String[] args) throws IOException
   {
      // Create a Scanner object for keyboard input.
      Scanner keyboard = new Scanner(System.in);
 
      // Get the file name.
      System.out.print("Enter the name of a file: ");
      String filename = keyboard.nextLine();
 
      // Open the file.
      File file = new File(filename);
      Scanner inputFile = new Scanner(file);
 
      // Read the first line from the file.
      String line = inputFile.nextLine();
 
      // Display the line.
      System.out.println("The first line in the file is:");
      System.out.println(line);
 
      // Close the file.
      inputFile.close();
   }
}


Confused | :confused:

Enter the name of a file: MyFriends.txt
Exception in thread "main" java.io.FileNotFoundException: MyFriends.txt (The system cannot find the file specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.jav a:138)
at java.util.Scanner.<init>(Scanner.java:611)
at ReadFirstLine.main(ReadFirstLine.java:21)
Java Result: 1
AnswerRe: Default My program does not find the file MyFriends.txt Pin
Richard MacCutchan11-Feb-21 22:24
mveRichard MacCutchan11-Feb-21 22:24 
Questionhow to write result in excel using java selenium. Pin
Member 1393850211-Feb-21 3:46
Member 1393850211-Feb-21 3:46 
AnswerRe: how to write result in excel using java selenium. Pin
Richard MacCutchan11-Feb-21 4:01
mveRichard MacCutchan11-Feb-21 4:01 
Generalhow to write result in excel using java selenium. Pin
Member 1393850211-Feb-21 3:32
Member 1393850211-Feb-21 3:32 
GeneralRe: how to write result in excel using java selenium. Pin
OriginalGriff11-Feb-21 3:50
mvaOriginalGriff11-Feb-21 3:50 
GeneralRe: how to write result in excel using java selenium. Pin
Cp-Coder11-Feb-21 3:51
Cp-Coder11-Feb-21 3:51 
JokeRe: how to write result in excel using java selenium. Pin
Slacker00711-Feb-21 4:14
professionalSlacker00711-Feb-21 4:14 
GeneralRe: how to write result in excel using java selenium. Pin
Richard MacCutchan11-Feb-21 4:34
mveRichard MacCutchan11-Feb-21 4:34 
GeneralRe: how to write result in excel using java selenium. Pin
Marc Clifton11-Feb-21 4:49
mvaMarc Clifton11-Feb-21 4:49 
QuestionJAVA PROGRAMMING Pin
Member 150686089-Feb-21 3:02
Member 150686089-Feb-21 3:02 
AnswerRe: JAVA PROGRAMMING Pin
Richard MacCutchan9-Feb-21 3:49
mveRichard MacCutchan9-Feb-21 3:49 
QuestionBarrons Ap Computer Science A / question on compound boolean Pin
Ap_noob12-Jan-21 12:45
Ap_noob12-Jan-21 12:45 
AnswerRe: Barrons Ap Computer Science A / question on compound boolean Pin
Richard MacCutchan12-Jan-21 22:40
mveRichard MacCutchan12-Jan-21 22:40 
QuestionConvert string array to integer without using loop? Thanks Azbilegt Chuluunbat Pin
Azbilegt Chuluunbat30-Dec-20 7:48
Azbilegt Chuluunbat30-Dec-20 7:48 
AnswerRe: Convert string array to integer without using loop? Thanks Azbilegt Chuluunbat Pin
Victor Nijegorodov30-Dec-20 8:20
Victor Nijegorodov30-Dec-20 8:20 
AnswerRe: Convert string array to integer without using loop? Thanks Azbilegt Chuluunbat Pin
Richard MacCutchan30-Dec-20 22:26
mveRichard MacCutchan30-Dec-20 22:26 
AnswerRe: Convert string array to integer without using loop? Thanks Azbilegt Chuluunbat Pin
Randor 31-Dec-20 1:30
professional Randor 31-Dec-20 1:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.