简体   繁体   English

用Java中的缩写替换关键字

[英]Replacing keywords with abbreviations in Java

I'm trying to create a kind of "shorthand" syntax for Java that replaces verbose keywords with less verbose ones, so that I can write Java code with fewer keystrokes. 我正在尝试为Java创建一种“速记”语法,用较少的冗长的关键字替换冗长的关键字,以便可以用较少的击键编写Java代码。 Is there any way to replace keywords such as "public" and "static" with abbreviations of those keywords, and then translate that to "normal" Java code? 有什么方法可以用这些关键词的缩写替换“ public”和“ static”等关键词,然后将其转换为“ normal” Java代码?

//would it be possible to convert this to "normal" Java code?
pu cl ModifiedSyntaxExample{
    pu st void main(){
        System.out.println("Hello World!")
    }
}

This would be equivalent to: 这等效于:

//would it be possible to convert this to "normal" Java code?
public class ModifiedSyntaxExample{
    public static void main(){
        System.out.println("Hello World!")
    }
}

The first version is less verbose (and therefore easier to type), because "public" and "class" are replaced with the abbreviations "pu" and "st". 第一个版本不那么冗长(因此更易于键入),因为“ public”和“ class”被缩写为“ pu”和“ st”代替。

If you are using any IDE than yes, its possible. 如果您使用的是IDE,则可能。 For example in eclipse you have one code snippets which you can configure in such a way that, you will make your code less verbose. 例如,在eclipse中,您可以配置一个code snippets ,从而可以减少代码的冗长程度。 I hope I have understood your question correctly. 希望我已正确理解您的问题。 for ex - sysout will print System.out.println(); 例如sysout将打印System.out.println(); for you. 为了你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM