I have a class name string. And a user input is read i.e a message or string.

Get the text message(i.e.string) from the user and convert the message into hexadecimal code and binary code. Then message is split into two parts. One is used as message end other one is used as a key, then XOR operation is performed.
can someone help me to code this? Thanks.

5 Years
Discussion Span
Last Post by boboi haokip

Don't use string as a variable name.
It will be too confusing with String, the data type.

import java.util.Scanner;
public class project {
public static void main(String[] args){

Scanner input = new Scanner(System.in);
string stringObject = new string();
System.out.println("Enter the plaintext:");
String name = input.nextLine();
[This is the main or sud i say the header code]

public class string {
public void text(String name){
System.out.println("The plaintext you enter is:\n" + name);


[string class]

public class hex
String stringToHex(String str)
char[] chars = str.toCharArray();
StringBuffer strBuffer = new StringBuffer();
for (int i = 0; i < chars.length; i++) {
strBuffer.append(Integer.toHexString((int) chars));
return strBuffer.toString();

This is my string to hex convert class. But I don't know how to include or join this class to the class project i.e. multiple class in one class. Check out the code and please help me if you can.

Edited by Nick Evan: Fixed formatting

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.