Skip to content

update code#16

Open
chathuryaadapa wants to merge 1 commit into
mainfrom
gn-3-8b
Open

update code#16
chathuryaadapa wants to merge 1 commit into
mainfrom
gn-3-8b

Conversation

@chathuryaadapa

Copy link
Copy Markdown
Owner

No description provided.

Comment thread code-opt.java
Comment on lines +16 to +25
Map<String, Integer> wordCount = new HashMap<>();
for (String word : words) {
int count = 0;
for (String w : words) {
if (w.equals(word)) {
count++;
}
}
wordCount.put(word, count);
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggested comment:

        Map<String, Integer> wordCount = new HashMap<>();
       for (String word : words) {
           int count = 0;
           for (String w : words) {
               if (word.equals(w)) {
                   count++;
               }
           }
           wordCount.put(word, count);
       }

from 16 to 25

Comment thread code-opt.java
Comment on lines +27 to +28
System.out.println(wordCount);
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggested comment:

        System.out.println(wordCount);

from 27 to 28

Comment thread main.java
Comment on lines +1 to +4
import java.io.BufferReader;
import java.io.BufferWriter;
import java.io.FileRead;
import java.io.FileWrite;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggested comment:

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;

from 1 to 4

Comment thread main.java
Comment on lines +85 to +89
int a = 5;
int b = 2;
double result = a / b;
System.out.println(result);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggested comment:

        int a = 5;
       int b = 2;
       double result = (double) a / b;
       System.out.println(result);

from 85 to 89

Comment thread main.java
Comment on lines +90 to +93
String name = "John";
if (name == "John") {
System.out.println("Hello, John!");
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggested comment:

        String name = "John";
       if (name.equals("John")) {
           System.out.println("Hello, John!");
       }

from 90 to 93

Comment thread reverse-of-string.java
Comment on lines +8 to +12
public static String reverseString(String str) {
String reversed = "";
for (int i = str.length() - 1; i >= 0; i--) {
reversed += str.charAt(i);
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggested comment:

public static String reverseString(String str) {
       StringBuilder reversed = new StringBuilder();
       for (int i = str.length() - 1; i >= 0; i--) {
           reversed.append(str.charAt(i));
       }
       return reversed.toString();
   }

from 8 to 12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants